Re: How does a gexp relate to a derivation?

2022-09-26 Thread Ludovic Courtès
Hi,

Ricardo Wurmus  skribis:

> I recommend the paper on Gexps that walks you through the alternatives
> and motivates the design of Gexps: https://hal.inria.fr/hal-01580582/en

The manual has a few examples to illustrate that:

  https://guix.gnu.org/manual/devel/en/html_node/G_002dExpressions.html

As an exercise, try to see how you’d write these examples if you were to
use sexps instead of gexps.  This is what Guix did before gexps, and it
was tedious and error-prone (the article above has more about it).

HTH,
Ludo’.



Re: How does a gexp relate to a derivation?

2022-09-18 Thread Ricardo Wurmus


jgart  writes:

> On Sat, 17 Sep 2022 17:43:17 +0200 Ricardo Wurmus  wrote:
>> ;;;
>> ;;;   2. Gexps embed information about the derivations they refer to.
>
> Why do gexps embed information about the derivations they refer to?

That’s the whole point.  Otherwise you could just use quasiquote /
unquote.

I recommend the paper on Gexps that walks you through the alternatives
and motivates the design of Gexps: https://hal.inria.fr/hal-01580582/en

-- 
Ricardo



Re: How does a gexp relate to a derivation?

2022-09-17 Thread jgart
On Sat, 17 Sep 2022 17:43:17 +0200 Ricardo Wurmus  wrote:
> ;;;
> ;;;   2. Gexps embed information about the derivations they refer to.

Why do gexps embed information about the derivations they refer to?



Re: How does a gexp relate to a derivation?

2022-09-17 Thread Ekaitz Zarraga



> > How does a gexp relate to a derivation?
> 
> 
> The module comment of (guix gexp) says this:
> 
> --8<---cut here---start->8---
> 
> ;;; This module implements "G-expressions", or "gexps". Gexps are like
> ;;; S-expressions (sexps), with two differences:
> ;;;
> ;;; 1. References (un-quotations) to derivations or packages in a gexp are
> ;;; replaced by the corresponding output file name; in addition, the
> ;;; 'ungexp-native' unquote-like form allows code to explicitly refer to
> ;;; the native code of a given package, in case of cross-compilation;
> ;;;
> ;;; 2. Gexps embed information about the derivations they refer to.
> ;;;
> ;;; Gexps make it easy to write to files Scheme code that refers to store
> ;;; items, or to write Scheme code to build derivations.
> --8<---cut here---end--->8---
> 
> 
> 
> 
> --
> Ricardo

So, in other words, a Gexp is a quotation system that has a context: the 
current derivation. So all the expansions happen with that in mind.

Correct?



Re: How does a gexp relate to a derivation?

2022-09-17 Thread Ricardo Wurmus


> How does a gexp relate to a derivation?

The module comment of (guix gexp) says this:

--8<---cut here---start->8---
;;; This module implements "G-expressions", or "gexps".  Gexps are like
;;; S-expressions (sexps), with two differences:
;;;
;;;   1. References (un-quotations) to derivations or packages in a gexp are
;;;  replaced by the corresponding output file name; in addition, the
;;;  'ungexp-native' unquote-like form allows code to explicitly refer to
;;;  the native code of a given package, in case of cross-compilation;
;;;
;;;   2. Gexps embed information about the derivations they refer to.
;;;
;;; Gexps make it easy to write to files Scheme code that refers to store
;;; items, or to write Scheme code to build derivations.
--8<---cut here---end--->8---



-- 
Ricardo



How does a gexp relate to a derivation?

2022-09-17 Thread jgart
Hi,


How does a gexp relate to a derivation?