gwl-devel
[Top][All Lists]
Advanced

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

Re: Comments on process template syntax


From: Ricardo Wurmus
Subject: Re: Comments on process template syntax
Date: Tue, 04 Feb 2020 11:10:33 +0100
User-agent: mu4e 1.2.0; emacs 26.3

Ricardo Wurmus <address@hidden> writes:

> This means that the examples above would be written as
>
>   process list-file-template (filename)
>     name …
>     inputs …
>     outputs …
[…]

I just realized that this is not easily accomplished without warts.  The
reason is that we have no way of distinguishing this

   (process list-file-template (filename)
     (name …)
     (inputs …)
     (outputs …))

from that

   (process list-file-template
     (filename)
     (name …)
     (inputs …)
     (outputs …))

or worse

   (process list-file-template
     (name foo bar)
     (name …)
     (inputs …)
     (outputs …))

Is this a process definition with two “name” fields?

Or what about this:

   (process list-file-template
     (name some-variable-name)
     (inputs …)
     (outputs …))

Is this a process template with two arguments “name” and
“some-variable-name”, or is this a process with a name field whose value
is whatever “some-variable-name” evaluates to?  The power of macros only
gets us that far.  Sure we could add even more heuristics and check
whether things in the first position are identifiers and such, but this
sounds terribly complex.

This can all be avoided with a tad more syntax, but it’s slightly less
elegant:

   process list-file-template (with filename)
     name …
     inputs …
     outputs …

This is obviously a template because it uses “with” followed by a list
of arguments.

Other ways of writing this in Wisp:

   process list-file-template
     with filename
     name …
     inputs …
     outputs …

or

   process list-file-template : with filename
     name …
     inputs …
     outputs …

Without (gwl sugar process) you can, of course, still write good ol’
procedures explicitly if you prefer, so all of this is optional:

   (define list-file-template
     (lambda (filename)
       (process
        (name …)
        (inputs …)
        (outputs …))))

Thoughts?

--
Ricardo



reply via email to

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