From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Enge Subject: Re: Some macros to make package definitions prettier Date: Wed, 25 Feb 2015 19:12:17 +0100 Message-ID: <20150225181217.GB6653@debian.math.u-bordeaux1.fr> References: <874mqa6iz4.fsf@taylan.uni.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQgRg-0004OR-PB for guix-devel@gnu.org; Wed, 25 Feb 2015 13:12:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQgRb-00039J-Ib for guix-devel@gnu.org; Wed, 25 Feb 2015 13:12:28 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:55337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQgRb-00039F-8l for guix-devel@gnu.org; Wed, 25 Feb 2015 13:12:23 -0500 Content-Disposition: inline In-Reply-To: <874mqa6iz4.fsf@taylan.uni.cx> 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: Taylan Ulrich =?utf-8?B?QmF5xLFybMSxL0thbW1lcg==?= Cc: guix-devel@gnu.org Hello, thanks for sharing your suggestions! On Wed, Feb 25, 2015 at 05:42:23PM +0100, Taylan Ulrich Bayırlı/Kammer wrote: > (delete foo) > (replace bar 'x) > (add-before baz pre-baz 'y)) ;=> ((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. The indentation is just a question of style; in my first recipes, I did not 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). > (phase-lambda ((inputs (libx liby)) > (outputs (out))) > ...) > > ;;; effectively equivalent to: > > (lambda* (#:key inputs outputs #:allow-other-keys) > (let ((libx (assoc-ref inputs "libx")) > (liby (assoc-ref inputs "liby")) > (out (assoc-ref outputs "out"))) > ...)) That looks actually quite useful to me. The general drawback of such syntax rules is that newcomers do not see all the inner cogwheels of the system. So on one hand, one gains that contributing packages becomes easier; on the other hand, understanding what is actually happening becomes harder, and also learning scheme through guix becomes more difficult as we move to our own domain specific language. Andreas