From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: Re: Some macros to make package definitions prettier Date: Wed, 25 Feb 2015 15:24:19 -0500 Message-ID: References: <874mqa6iz4.fsf@taylan.uni.cx> <20150225181217.GB6653@debian.math.u-bordeaux1.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQiVO-0007JQ-9L for guix-devel@gnu.org; Wed, 25 Feb 2015 15:24:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQiVJ-0008Ea-99 for guix-devel@gnu.org; Wed, 25 Feb 2015 15:24:26 -0500 Received: from na3sys009aog138.obsmtp.com ([74.125.149.19]:35522 helo=mail-pd0-f172.google.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQiVJ-0008ER-0q for guix-devel@gnu.org; Wed, 25 Feb 2015 15:24:21 -0500 Received: by pdjy10 with SMTP id y10so7280656pdj.13 for ; Wed, 25 Feb 2015 12:24:19 -0800 (PST) In-Reply-To: <20150225181217.GB6653@debian.math.u-bordeaux1.fr> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Andreas Enge Cc: guix-devel On Wed, Feb 25, 2015 at 1:12 PM, Andreas Enge wrote: > > On Wed, Feb 25, 2015 at 05:42:23PM +0100, Taylan Ulrich Bay=C4=B1rl=C4=B1= /Kammer wrote: >> (delete foo) >> (replace bar 'x) >> (add-before baz pre-baz 'y)) ;=3D> ((bar . x) (pre-baz . y) (baz . 2)) >> This has the following advantages: >> - The order in which the phases are modified is top-down, where in our >> current style it's bottom-up which both distracts (IMO), and one may >> forget, as the chain grows and one forgets that it's indeed just a >> chain of function calls like (foo (bar (baz x))). >> - Indentation doesn't keep growing as one adds more modifications. > > Actually, I do not like the imperative, non-functional style of these > syntax rules. For me, they rather obscure what is happening. It's still functional. Should we not use 'cond' because it obscures the series of nested 'if' expressions that it truly is? > The indentation is just a question of style; in my first recipes, I did n= ot > indent consecutive modifications of phases, which was just as readable, > I think (but this only works if you indent manually, and people disliked > the unorthodox (non-)indentation). Yeah, I'm not too into manual indenting to make a nested form look linear. > The general drawback of such syntax rules is that newcomers do not see al= l > the inner cogwheels of the system. So on one hand, one gains that contrib= uting > packages becomes easier; on the other hand, understanding what is actuall= y > happening becomes harder, and also learning scheme through guix becomes m= ore > difficult as we move to our own domain specific language. It's a balancing act. We can certainly go overboard with macros. However, I think it's important to build up our packaging language to be more expressive and declarative. So, a macro to hide the nested alist consing that we do constantly is appealing to me. My 2 cents, - Dave