On 26.02.2009, at 20:25, Chouser wrote:

> I've got essentially the same thing for use in error-kit:
>
>   (defn- qualify-sym [sym]
>     (let [v (resolve sym)]
>       (assert v)
>       (apply symbol (map #(str (% ^v)) [:ns :name]))))

Except that you get the information from the metadata. I wonder which  
method is safer in the long run?

> Of course it depends on the var existing at the time the macro is
> expanded, but if that weren't true how could the macro have any idea
> what namespace the symbol belonged to?

Given that I want to replicate exactly what happens when the compiler  
resolves a symbol, the only problem would be a symbol referring to  
something else than a var. My understanding is that that shouldn't  
happen.

> BTW, I'd recommend avoiding using the name of builtins like 'var' for
> your own locals.

In theory I agree, but in practice I can't remember all those  
builtins, most of which I never use...

Konrad.


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