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

Re: Do we NEED a marker at all?



2012/9/5 David A. Wheeler <dwheeler@xxxxxxxxxxxx>:
> John Cowan:
>> http://trac.sacrideo.us/wg/wiki/BracketsBraces shows the meaning
>> of square brackets and curly braces in my Scheme test suite, which
>> currently includes 45 implementations.  Only Chibi and RScheme currently
>> do something special with braces; the other implementations treat them
>> as either synonyms for parentheses, lexical syntax errors, or identifier
>> characters.

In Racket read-syntax will store the type of parenthesis used in the
syntax object.
This implies that macros can use this information during expansion.

See:

http://docs.racket-lang.org/reference/reader.html?q=paren#(idx._(gentag._30._(lib._scribblings/reference/reference..scrbl)))

Combining this with #%app one can make (foo bar) mean one thing and {foo bar}
mean another thing without messing with the reader.

A random example of this:
   https://github.com/soegaard/this-and-that/blob/master/brevity/brevity.rkt

But search the Racket mailing list archive for other examples.

/Jens Axel