On Jan 13, 2009, at 14:04, Mark P wrote:

> Then what do people mean when they say that lisp blurs
> the distinction between compile-time and run-time?

I don't know. I can only guess that they may be referring to the fact  
that many Lisp dialects have both an interpreter and a compiler. Or  
to the fact that macros (executed at compile time) can call functions  
that are also available at runtime. Or to the fact that in  
interactive sessions in a purely compiled Lisp (such as Clojure),  
every expression gets  compiled on the fly just before being  
executed. Or again to the fact that you have the function eval, which  
calls the compiler at runtime.

Anyway, in Clojure there is a clear distinction between compiling an  
expression, i.e. producing equivalent JVM bytecodes, and executing  
it, i.e. running the JVM bytecode.

> I thought macros could get executed at runtime as
> follows.  Suppose I have a domain-specific-language
> implemented in a lisp, using macros.  Suppose at
> runtime some of this domain-specific-code gets
> generated somehow (code is data at this point).
> An "eval" is executed on this domain-specific-code,
> which causes the macros (used to implement the
> domain-specific-language) to transform the input
> code at runtime.
>
> Is this wrong?

You can do that but it is rarely done. DSLs are typically implemented  
as ordinary functions and macros without calling eval. Eval is there  
for very specific needs, such as implementing interactive  
interpreters. And even in those specific applications, I wouldn't  
expect the CPU time requirements of eval to be important.

> I also thought that when a "clojure application" is
> bundled up as java bytecode, this "executable"
> actually includes the clojure compiler.  Why would
> this be included if compilation (including macros)
> is never performed at runtime?

As long as you want to be able to call eval, you need the compiler to  
be around. I guess most Clojure applications could be bundled up  
without including the compiler, but perhaps this is too much effort  
to be worth pursuing.

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