IMeta only allows you to read metadata.
IObj is for immutable data that can be duplicated with new metadata.
IReference is for references.

So an immutable map would implement IObj, but an atom would implement
IReference.

If you want to support metadata, you need to decide what type of object it
is; is it mutable or immutable?

On 2 November 2017 at 01:20, Didier <didi...@gmail.com> wrote:

> Hey, I was surprised to find that IMeta does not work for (with-meta).
>
> So it seems that withMeta is added to IObj, which extends IMeta. And it
> seems like alterMeta and resetMeta are added in IReference, which also
> extends IMeta.
>
> So now if you want to support meta, you have to implement IReference, IObj
> and IMeta?
>
> Is there a reason for this? Particularly, I find it strange I can't use
> with-meta on a Var, because it only implements IReference, and not IObj. So
> I can use all meta functions on Vars except for with-meta.
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
James Reeves
booleanknot.com

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to