Hi,

On Mar 19, 9:16 am, alux <alu...@googlemail.com> wrote:

> is this a bug or a feature? (And how could I know.)
>
> spels=> (macroexpand `(huhu huhu.))
> (spels/huhu huhu.)
>
> If the symbol ends with a dot, it doesnt get resolved with name space.
> I suspect thats because it will get special interpretation as Java
> constructor. But what kind of magic is at work here?

This is exactly the case. The magic is `. It either expands the
classname to the full qualified version, if the class is exported. Or
it leaves it alone otherwise.

The reason is, that you can have a class frobnicator.Foo imported in
the namespace where you define your macro. However the user may use
your macro in a namespace which imports yoyodyne.Foo. If the Foo. in
your macro was left alone, it would now refer to yoyodyne.Foo instead
of the intended frobnicator.Foo.

If the class is not imported it must be by definition fully qualified.
And hence ` leaves the symbol with trailing . alone.

Note that something similar happens to the .method notation.

Sincerely
Meikel

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to