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

Re: Prefix, not postfix

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:
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:


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