[Prev][Next][Index][Thread]
Re: Simple Reader Macros for Dylan
----- Original Message -----
From: Jonathan Bachrach <jrb@functionalobjects.com>
To: <info-dylan@ai.mit.edu>
Sent: Tuesday, November 16, 1999 8:14 AM
Subject: Simple Reader Macros for Dylan
[...]
> Simple Reader Macros
>
> The syntax:
>
> #<name>:<text>
>
> gets transformed, setter-like, into:
>
> <name>-parser(<text>)
Hmmm, so these are not so much reader macros as just a new bit of syntactic
sugar, correct? <name>-parser doesn't actually get called at compile-time,
correct?
[...]
> An example parser:
>
> define method html-parser
> (text :: <byte-string>) => (doc :: <html-document>)
> make(<html-document>, text: text);
> end method;
>
> If an appropriate function isn't defined, you get a standard unbound
variable
> reference message indicating the # literal.
I assume errors are reported by the parser throwing some condition?
> Also in order to allow these sort of literals in literal lists and
vectors,
> we further propose to allow arbitrary expressions in "literal" lists
> and vectors. The same constancy/sharing rules would still apply to the
> lists and vectors themselves. That is:
>
> let times = #[#time:12:30am, #time:4:15pm];
> ==
> let times = #[time-parser("12:30am"), time-parser("4:15pm")];
>
> which is allowed, but still:
>
> times[0] := times[1];
>
> "is an error" in case the compiler can work its magic.
You've lost me here... Why is the above assignment an error?
-- Kaelin
References: