gwl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gwl-devel] variable interpolation in code snippets


From: Ricardo Wurmus
Subject: Re: [gwl-devel] variable interpolation in code snippets
Date: Fri, 07 Jun 2019 16:59:51 +0200
User-agent: mu4e 1.2.0; emacs 26.2

Ricardo Wurmus <address@hidden> writes:

>> It improves the readibilty.
>> However, does the keyword `list` is mandatory ?
>
> Unfortunately it is mandatory.  Previously, I tried to give the record
> field a “smart constructor” that takes either one value (a list or a let
> binding resulting in a list) or — for convenience – multiple values that
> are then turned into a list.
>
> With the Guix-style records this does not seem to be possible.  If we
> want to make this work we’d have to use our own extended records or
> maybe switch to GOOPS.  GOOPS offers virtual slots that can have
> slot-ref and slot-set! procedures, which would handle the conversion
> transparently.  I think this would be a good way forward — and it would
> decouple the GWL from the Guix version in use, because those extended
> record are really made for Guix and may not forever match the needs of
> the GWL.

We’re now using GOOPS for the <process> type.  I implemented field
validation and implicit lists, so this is now possible:

--8<---------------cut here---------------start------------->8---
process: run-bash
  package-inputs "bash"
  data-inputs
    . "a"
    . #:awesome "b"
    . "c"
  procedure # bash {
    echo "The name of this process: {{name}}."
    echo "The most awesome of the data inputs is: {{data-inputs:awesome}}."
  }
--8<---------------cut here---------------end--------------->8---

The dots are necessary to continue broken lines, but it’s also fine to
put everything on one line:

   data-inputs "a" #:awesome "b" "c"

With a reader option we could shave off one more character from the
keyword syntax and use this instead:

   data-inputs "a" :awesome "b" "c"

Lists are still valid, of course, they are just optional:

   data-inputs : list "a" :awesome "b" "c"

or

   data-inputs
     list "a" :awesome "b" "c"

--
Ricardo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]