On Sun, Mar 29, 2009 at 11:33 PM, Allen Rohner <aroh...@gmail.com> wrote:
>
> I noticed an inconsistency with refs and get:
>
> (def ref-map (ref {:a 1, :b 2}))
>
> (ref-map :a)
> => 1
>
> (get ref-map :a)
> => nil
>
> Now I haven't seen any documentation that getting the value of a ref
> without a @/deref is supported at all, so maybe this isn't supported.

It isn't, and that's not what you are seeing. Refs implement IFn by
dispatching to their values.

> But if those forms are supported, both forms should return the same
> value,

I disagree. When you understand what's happening (Refs implement IFn
by dispatching, just like Vars), you see that it has nothing to do
with obtaining the value of a ref without deref, and get can't work
since it doesn't take a ref.

> and if it isn't supported, I think they should throw
> exceptions.
>
> I'm willing to write patches either way.
>

No patch needed.

Rich

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to