FORM of GROUP!s, GET-WORD!s...

Trying to write shell code in Rebol, you notice that bash has a pretty strong advantage of putting together fragments of text with environment variables.

I think we'd have a leg up if there were a behavior in something that didn't reduce strings--like FORM--if it would make an exception for GROUP!s.

Historically you get something pretty useless:

rebol2>> form [--sysroot (first [/foo /bar])]
== "--sysroot first /foo /bar"

red>> form [--sysroot (first [/foo /bar])]
 == "--sysroot first /foo /bar"

I don't see that helping a whole lot. Evaluating the group would make more sense.

>> form [--sysroot (first [/foo /bar])]
== "--sysroot /foo"

As an aside, I've always thought FORM is a weird name for this. Maybe it needs a better name.

But whatever it is, I think we need something like it for putting together bash-like "sentences", without having to use so many quotes...because every character adds up:

>> spaced [{--sysroot} (first ["/foo" "/bar"])]
== "--sysroot /foo"

I'll point out that having greater flexibility on what is a legal PATH!, permitting foo/bar/ and /foo/ etc. really is already helping a lot for common cases of writing shell-like scripts.

2 Likes