From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:42244) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGLq-0001eo-Jl for gwl-devel@gnu.org; Fri, 07 Jun 2019 11:00:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGLm-0005GR-DN for gwl-devel@gnu.org; Fri, 07 Jun 2019 11:00:16 -0400 Received: from sender4-of-o53.zoho.com ([136.143.188.53]:21375) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGLg-00054l-Ew for gwl-devel@gnu.org; Fri, 07 Jun 2019 11:00:09 -0400 References: <87lg2atsxx.fsf@elephly.net> <87mumj0xzq.fsf@elephly.net> <87pnrez7zg.fsf@elephly.net> <87blzll7be.fsf@elephly.net> <87r28airk4.fsf@elephly.net> From: Ricardo Wurmus In-reply-to: <87r28airk4.fsf@elephly.net> Date: Fri, 07 Jun 2019 16:59:51 +0200 Message-ID: <87d0jpjva0.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: variable interpolation in code snippets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gwl-devel-bounces+kyle=kyleam.com@gnu.org Sender: "gwl-devel" To: zimoun Cc: gwl-devel@gnu.org Ricardo Wurmus 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 =E2=80=9Csmart constructor=E2=80=9D that takes either one value (= a list or a let > binding resulting in a list) or =E2=80=94 for convenience =E2=80=93 multi= ple 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=E2=80=99d 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 =E2=80=94 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=E2=80=99re now using GOOPS for the 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=E2=80=99s 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