On Jan 19, 1:05 am, Stuart Sierra <the.stuart.sie...@gmail.com> wrote:
> On Jan 18, 6:56 pm, Anand Patil <anand.prabhakar.pa...@gmail.com>
> wrote:
>
> > Would it make any sense to make @ polymorphic so that @x return x's
> > value when x is a var rather than raising an error?
>
> Actually, it already is:
>
> user> (def x 5)
> #'user/x
> user> (deref (var x))
> 5
> user> @(var x)
> 5
>
> @x is just shorthand for (deref x), which resolves to (deref 5), which
> doesn't make sense.

Stuart,

Sorry, I was not being clear. Why not just let (deref 5) return 5? I
would consider that syntactic sugar, as it would make it easier to
deref a mixed vector of refs, constants, agents and atoms without
keeping track of which indices correspond to (ref, agent, atom)s and
which to constants.

Thanks,
Anand


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