unofficial mirror of gwl-devel@gnu.org
 help / color / mirror / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: gwl-devel@gnu.org
Subject: merging “processes” and “restrictions”
Date: Sat, 19 Jan 2019 09:55:58 +0100	[thread overview]
Message-ID: <87bm4df2ld.fsf@elephly.net> (raw)

Hi,

I think it is unfortunate that workflows have two fields for specifying
processes: one is “processes” the other is “restrictions”.  It seems to
me that we can do without “restrictions” by relaxing the requirements
for the “processes” value.

The use of both fields sometimes makes it necessary to wrap the whole
workflow definition in a let binding so that both fields can access
identical values:

  (let ((eat-fruit (eat "fruit"))
        (eat-veges (eat "vegetables")))
    (workflow
     (name "simple")
     (processes
      (list greet
            eat-fruit
            eat-veges
            sleep
            bye))
     (restrictions
      `((,eat-fruit ,greet)
        (,eat-veges ,greet)
        (,sleep ,eat-fruit ,eat-veges)
        (,bye ,sleep)))))

This looks like a minor improvement to me because the let can be where
it’s needed:

    (workflow
     (name "simple")
     (processes
      (let ((eat-fruit (eat "fruit"))
            (eat-veges (eat "veges")))
        (list (list eat-fruit greet)
              (list eat-veges greet)
              (list sleep eat-fruit eat-veges)
              (list bye sleep)))))

All of the elements of the list together is equivalent to the list of
processes.  The “processes” field now also doubles as a “restrictions”
field as the value can be an adjacency list of processes to their
dependencies.

For trivial processes where none of the processes depend on each other
it would look like this:

    (workflow
     (name "simple")
     (processes
       (list (list A)
             (list B)
             (list C))))

With just a little bit of extra processing before storing the value it
could become this instead:

    (workflow
     (name "simple")
     (processes A B C))

If you’re like me you’ll find that the restrictions syntax looks rather
verbose with all those “list”s.  Using quoting doesn’t make this any
more readable, unfortunately:

    (workflow
     (name "simple")
     (processes
      (let ((eat-fruit (eat "fruit"))
            (eat-veges (eat "veges")))
        `((,eat-fruit ,greet)
          (,eat-veges ,greet)
          (,sleep ,eat-fruit ,eat-veges)
          (,bye ,sleep)))))

Can we use macros to clarify the syntax?

    (workflow
     (name "simple")
     (processes
      (let ((eat-fruit (eat "fruit"))
            (eat-veges (eat "veges")))
        (graph (eat-fruit -> greet)
               (eat-veges -> greet)
               (sleep     -> eat-fruit eat-veges)
               (bye       -> sleep)))))

“graph” would be a macro that takes any number of node to node
associations, each of which are expected to be in the form

    (node -> nodes …)

“graph” isn’t a great name.  Maybe you can suggest a different name or
even a character…

What do you think?

--
Ricardo

             reply	other threads:[~2019-01-19  8:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-19  8:55 Ricardo Wurmus [this message]
2019-01-19 10:26 ` merging “processes” and “restrictions” zimoun
2019-01-19 11:45   ` Ricardo Wurmus
2019-01-19 17:55     ` zimoun
2019-01-19 20:51       ` Ricardo Wurmus
2019-01-21 18:45         ` zimoun
2019-01-21 22:51           ` Ricardo Wurmus
2019-01-22  8:49             ` zimoun
2019-01-21 14:43     ` Ricardo Wurmus
2019-01-21 18:53       ` zimoun
2019-01-21 15:32     ` Ricardo Wurmus
2019-01-21 18:55       ` zimoun
2019-01-21 19:33       ` Ricardo Wurmus
2019-01-21 19:59         ` zimoun
2019-01-26 21:49           ` 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=87bm4df2ld.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=gwl-devel@gnu.org \
    /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).