Email list hosting service & mailing list manager


Re: Prefix, not postfix Per Bothner 11 Apr 2006 22:51 UTC

Taylor R. Campbell wrote:
>   foo: bar baz: quux zot: mumble
>
> In the last one I find it hard to tell where one pair ends and the
> next one begins.  On the other hand, with a prefix, the delimitation
> of the pairs is very clear:
>
>   :foo bar :baz quux :zot mumble

An alternative worth considering is an infix syntax.  For example:

(button color="red" font="Helvetica")

I.e. the syntax is:
   <identifier>=<expression>
This would be translated by the reader into (say):
   (make-association '<identifier> <expression>)

[This is similar to John Cowan's suggestion.  However,
I'm not sure I want to specify association lists, since
I think a separate type is preferable.]

This is of course familiar from XML and HTML.

Unfortunately, this syntax does conflict with historical
<identifier> syntax in certain presumably-very-rare cases.
That might be acceptable or not.  If not, we could find
some other syntax, but there is a tradeoff between nice
syntax and 100% compatibility.  Some ideas:

[color]"red"
{color}="red"
#{color}"red"

We could also have the RHS be a quasi-quoted <datum> rather than
<expression>:
(button color=red font=Helvectica)
You'd use comma (unquote) to evaluate an expression:
(button color=,current-color font=,(select-font))
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/