I think Artur described it well. I don't think the docs are wrong. The thing is
just understanding that the reader macro syntax is interpreted by the reader.
The reader comes before the evaluation of the compiler (there is grey area here
with read-eval but that's another topic).
Since a
I had the same issue a couple of months ago. The thing to understand
is that 'a is NOT a symbol. Actually, it evaluates to a symbol, which
is a different thing.
When you write ^{:a 1} 'a, it is the same as writing ^{:a 1} (quote
a). So the metadata gets applied to the entire form, not the symbol.
I have a deftype that supports with-meta, but I can't figure out how to
support caret reader syntax.
To support with-meta, I include a "meta" field and implement IObj methods
"meta" and "withMeta". Seems to work just fine:
(with-meta (entity-map [:A/B] {:a 1}) {:foo "metadata here"})
But
On Fri, Sep 4, 2015 at 11:30 AM, Gregg Reynolds wrote:
> I have a deftype that supports with-meta, but I can't figure out how to
> support caret reader syntax.
>
> To support with-meta, I include a "meta" field and implement IObj methods
> "meta" and "withMeta". Seems to
On Fri, Sep 4, 2015 at 7:51 PM, Mike Rodriguez wrote:
> This has came up numerous times in other posts here. I can't hunt them
> down currently but the quoted symbol issue you showed is just a
> misunderstanding of how the reader macro for metadata works.
>
> Try (meta '^{:foo
This has came up numerous times in other posts here. I can't hunt them down
currently but the quoted symbol issue you showed is just a misunderstanding of
how the reader macro for metadata works.
Try (meta '^{:foo :bar} a)
When you put the reader macro in front of the quote it is applied to