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

Re: Prefix, not postfix

This page is part of the web mail archives of SRFI 88 from before July 7th, 2015. The new archives for SRFI 88 contain all messages, not just those from before July 7th, 2015.



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
per@bothner.com   http://per.bothner.com/