unofficial mirror of gwl-devel@gnu.org
 help / color / mirror / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: zimoun <zimon.toutoune@gmail.com>
Cc: gwl-devel@gnu.org
Subject: Re: variable interpolation in code snippets
Date: Wed, 29 May 2019 15:27:17 +0200	[thread overview]
Message-ID: <87blzll7be.fsf@elephly.net> (raw)
In-Reply-To: <CAJ3okZ1e84FT1NF9R2nD5xVxzRjB6UjBWap1KOTZ4KJPZcK0rA@mail.gmail.com>


zimoun <zimon.toutoune@gmail.com> writes:

> On Tue, 26 Feb 2019 at 20:05, Ricardo Wurmus <rekado@elephly.net> wrote:
>>
>> Yes, I think this is pretty nice.  I’ll aim for something like this:
>>
>> --8<---------------cut here---------------start------------->8---
>> process: foo
>>   data-inputs
>>     named-list
>>       foo = 1
>>       bar = hello
>>       baz = world
>>   procedure # bash { cat {{data-inputs.foo}} {{data-inputs.bar}} }
>> --8<---------------cut here---------------end--------------->8---
>>
>> Haven’t thought much about it, but “named-list” (or whatever the final
>> name) would introduce a let binding or something.
>
> Yes!
> The "named-list" would be the name of the reader macro, right?
> (joke: "named-list" is a better name than "xyz-list" ;-)

I took a simpler route using keywords to tag or name items in a list.
This works now:

--8<---------------cut here---------------start------------->8---
process: foo
  data-inputs
    list
      #:foo 1
      #:bar hello
      #:baz world
  procedure # bash { cat {{data-inputs:foo}} {{data-inputs:bar}} }
--8<---------------cut here---------------end--------------->8---

You can choose to only tag one item if you want; it works just the same:

--8<---------------cut here---------------start------------->8---
process: foo
  data-inputs
    list
      1
      #:bar hello
      world
  procedure # bash { echo {{data-inputs:bar}} }
--8<---------------cut here---------------end--------------->8---


--
Ricardo

  reply	other threads:[~2019-05-29 15:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 14:50 variable interpolation in code snippets Ricardo Wurmus
2019-02-25 23:00 ` zimoun
2019-02-26  8:12   ` Ricardo Wurmus
2019-02-26 17:35     ` zimoun
2019-02-26 19:04       ` Ricardo Wurmus
2019-02-26 19:29         ` zimoun
2019-05-29 13:27           ` Ricardo Wurmus [this message]
2019-06-03 14:54             ` zimoun
2019-06-03 16:04               ` Ricardo Wurmus
2019-06-03 18:19                 ` Roel Janssen
2019-06-07 14:59                 ` Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.guixwl.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blzll7be.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=gwl-devel@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).