On Fri, Nov 27, 2009 at 8:45 AM, Stefan Kamphausen
<[email protected]>wrote:
> > Why? Well because #^ attaches the metadata to the next read form.
> > What's the next read form? It's 'greet. But in fact 'greet is just
> > sugar for (quote greet). So we're actually affixing the metadata to a
> > list containing two symbols (quote and greet). When the compiler
> > evaluates (quote greet) it turns it into just the symbol greet and then
> > throws the list (and thus our metadata) away.
>
> This is subtle! It really feels like one of those things that will
> still feel creepy another 50 years from now.
> I'll have to meditate on this a bit.
Maybe this ought to be fixed; i.e., if the reader sees #^{meta} 'foo it
applies the metadata to foo first, then quotes it, resulting in the same
thing as (quote #^{meta} foo).
It would mean the reader would have to see #^{meta} and then store that,
then read the next item. Currently, if the next item is also a reader macro,
it expands that and then applies the meta to the result. Instead, if the
next item was a read macro with an "argument" (like ' or even ^ or @ or
whatever) it would apply the meta to the argument, then apply the new reader
macro.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en