[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: XML as a transition to s-expr
Paul Graham wrote:
> > > I've found from experimenting with various syntactic tricks
> > > in Arc that it's actually a win if all the delimiters are
> > > parens. It's a real nuisance to have expressions that end
> > > ))})]), because you can't tell if you've put the } in the
> > > right place.
> > >
> >
> > Emacs will match [] and {} as well as (). Don't other editors? I
> > don't
> > like the visual look of ))})]) but it's easier to grok some kinds of
> > statements when you have multiple delimiters
>
> It's a lose in a couple ways. When you're typing you have
> to stop and think about whether you're closing off a { [ or (,
> and when you change code you can't tell just by looking at it
> whether it's still correct. If you always use the same
> character for a delimiter, all you have to worry about is
> whether you have the right number of them.
In PLT Scheme, it typically seems to be used over a fairly narrow scope,
such as the variable declarations in a let, or the conditions of a cond or
case. So it's not common, from what I've seen, to end up with closing
statements like ))})]). And, as Shriram pointed out, the editor can help,
too.
Alternate delimiters can also address what I think is a valid concern which
someone raised earlier: that in the presence of special forms and macros,
parentheses mean different things in different places, and it can require
scanning for context to figure out what you're looking at. Judicious use of
an alternative delimiter can help here, and since this mainly applies to the
kinds of cases I mentioned above, it still mostly avoids the "))})])"
problem.
In fact, I could see an argument, in a new language, for having bracketing
around non-function-calls *require* an alternative delimiter, (optionally?)
enforced by the compiler. Experienced Lispers would hate that, I'm sure,
but it would actually remove an ambiguity, afaict.
The biggest disadvantage I've found with alternate delimiters in practice is
that most Lisp-oriented tools choke on them, but I suppose one could use
translators to mitigate that in some cases.
Anton