unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How does a gexp relate to a derivation?
@ 2022-09-17 15:29 jgart
  2022-09-17 15:43 ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: jgart @ 2022-09-17 15:29 UTC (permalink / raw)
  To: Guix Help

Hi,


How does a gexp relate to a derivation?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How does a gexp relate to a derivation?
  2022-09-17 15:29 How does a gexp relate to a derivation? jgart
@ 2022-09-17 15:43 ` Ricardo Wurmus
  2022-09-17 17:01   ` Ekaitz Zarraga
  2022-09-17 18:01   ` jgart
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2022-09-17 15:43 UTC (permalink / raw)
  To: jgart; +Cc: help-guix


> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How does a gexp relate to a derivation?
  2022-09-17 15:43 ` Ricardo Wurmus
@ 2022-09-17 17:01   ` Ekaitz Zarraga
  2022-09-17 18:01   ` jgart
  1 sibling, 0 replies; 6+ messages in thread
From: Ekaitz Zarraga @ 2022-09-17 17:01 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: jgart, help-guix



> > 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?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How does a gexp relate to a derivation?
  2022-09-17 15:43 ` Ricardo Wurmus
  2022-09-17 17:01   ` Ekaitz Zarraga
@ 2022-09-17 18:01   ` jgart
  2022-09-18 10:56     ` Ricardo Wurmus
  1 sibling, 1 reply; 6+ messages in thread
From: jgart @ 2022-09-17 18:01 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: help-guix

On Sat, 17 Sep 2022 17:43:17 +0200 Ricardo Wurmus <rekado@elephly.net> wrote:
> ;;;
> ;;;   2. Gexps embed information about the derivations they refer to.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How does a gexp relate to a derivation?
  2022-09-17 18:01   ` jgart
@ 2022-09-18 10:56     ` Ricardo Wurmus
  2022-09-26  8:47       ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2022-09-18 10:56 UTC (permalink / raw)
  To: jgart; +Cc: help-guix


jgart <jgart@dismail.de> writes:

> On Sat, 17 Sep 2022 17:43:17 +0200 Ricardo Wurmus <rekado@elephly.net> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How does a gexp relate to a derivation?
  2022-09-18 10:56     ` Ricardo Wurmus
@ 2022-09-26  8:47       ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2022-09-26  8:47 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: jgart, help-guix

Hi,

Ricardo Wurmus <rekado@elephly.net> 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’.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-26  8:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17 15:29 How does a gexp relate to a derivation? jgart
2022-09-17 15:43 ` Ricardo Wurmus
2022-09-17 17:01   ` Ekaitz Zarraga
2022-09-17 18:01   ` jgart
2022-09-18 10:56     ` Ricardo Wurmus
2022-09-26  8:47       ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).