On Oct 22, 2008, at 12:43 AM, Krukow wrote:

> Ok, thanks. I'm still a bit unsure as to how to think about it
> conceptually. I made the following experiment in the REPL
>
> user> (eval (list (symbol "Object.")))
> [EMAIL PROTECTED]
> user>
>
> This seems to indicate that actually Object. is just a symbol like any
> other. So there isn't any special reader support for it, but instead
> the compiler handles symbols with dots specially (depending on where
> the dot is in the symbol - beginning middle end).

Good experiment. Conceptually there is a time when macro forms are  
expanded until there are no macros left in them. That's the time when  
(X. ...) becomes (new X ...).

It appears that the expansion is done (in part) by the function  
Compiler/macroexpand1. It's given a list to expand and it first checks  
if the first item is a special form. If yes, there's no more expansion  
to do. It then checks if it names a macro. If yes, it calls the macro  
function to get the expansion. If not, it then checks if it's a symbol  
with a leading period and expands appropriately if it is. Finally  
(line 4041 of Compiler.java currently), it checks for a trailing  
period. If yes, it replaces the expression with the equivalent "new".

You can see this in the REPL as:

        user> (macroexpand-1 '(Object.))
        (new Object)

There is also reader support for the trailing period (LispReader.java: 
892), but that appears only to be used in the new "#=" reader macro.

--Steve


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to