On Jan 13, 8:04 am, Mark P <pierh...@gmail.com> wrote: > > A macro cannot depend on runtime information. A macro is a function > > that is called at compile time, its argument is an expression (as > > written by the programmer, or as returned by another macro), and its > > result is a modified expression. There is no way a macro could access > > runtime information. It is a program that works on program code, not > > on runtime data. > > Then what do people mean when they say that lisp blurs > the distinction between compile-time and run-time? I > thought that "macros executing at runtime" was part > of this. But if not, I don't know what they do mean. > > 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? > > 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? > > Is there something fundamental I am not > understanding? > > Thanks, > > Mark P.
I realize this thread has long since changed gears, but you may find your answer in Chapter 8 of Practical Common Lisp (http:// www.gigamonkeys.com/book/). Look for the section titled 'Macro Expansion vs. Runtime". Basically, it's like Konrad said, macros are executed at 'macro expansion time' which is during the compilation phase. However, Peter Seibel does mention that when interpreted (vs compiled) the line between macro expansion time and runtime becomes kind of fuzzy because they become intertwined. He mentions that it is not explicitly defined when an interpreter must expand macro's. It could expand all the macros up front, or do it lazily as it comes across them, but that doesn't change the fact that they must be expanded first so that the actual runtime code can be produced and executed. Hope this helps. -Ryan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---