Hi Karl,

On 22 Okt., 06:43, Krukow <[EMAIL PROTECTED]> wrote:
> 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).
>
> Is this the right way to think about it?
Yes. Symbols with dots in the beginning and the end are special.
- .method:
  (.method x) <=> (. x method) (or more verbose: (. x (method)))

- Foo.:
  (Foo.) <=> (new Foo)

While the first is a nice abbreviation for things like ->, I don't
particularly like the second. The . is quickly overlooked.

> @Bill: Yes, I did see defmacro in boot - I didn't understand it
> completely at first read. I think I do now. A macro is just a function
> that maps a data structure to a data structure. Additionally the var
> has a special property 'macro' set to true, which has implications for
> the compiler. I guess this implies that one can take any function
> already defined (even if not intended to be a macro) simply by doing
> (. (var name) setMacro)?
What is a macro actually? A macro is nothing else than a function on
code (data structures actually) returning (most likely) different
code.
However a function, which is applied at compile time. While a normal
function is applied at runtime. The setMacro call just tells the
compiler when to apply the function and whether to evaluate its
arguments or not. Then whatever this function returns is used as new
input for the compiler at the original position of the macro call.

So, yes, theoretically one can make every function behave like a
macro.
Whether this makes sense.... Different story.

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