Leaving out the dreaded "h" word--that's a whole other can of worms--at run time, after LLVM has fully lowered us down to the machine, all you have is native code. The AST is gone, and there's nothing left to modify! In practice, this does not seem to be a substantial limitation, and is more than made up for by the benefits of JIT compilation.
For a nice introduction to the path taken by Julia code from entry to execution, see Leah Hanson's exploration of the introspection tools: http://blog.leahhanson.us/julia-introspects.html On Thursday, July 3, 2014 2:22:29 PM UTC-5, Andrew McKinlay wrote: > > But I thought Julia was homoiconic. Can't a Julia program modify itself at > run-time? > > On Saturday, June 21, 2014 3:02:35 PM UTC-4, Patrick O'Leary wrote: >> >> The answer to your question about the second part of Jameson's response >> is the first part of Jameson's response--at compile time you can still >> modify the syntax tree of the program. >> >> On Saturday, June 21, 2014 1:50:45 PM UTC-5, Andrew McKinlay wrote: >>> >>> What can I do at compile-time that I can't at run-time? >>> On Jun 21, 2014 2:49 PM, "Jameson Nash" <[email protected]> wrote: >>> >>>> A macro inserts the result back into the AST. and it is called at >>>> compile-time, not run-time. >>>> >>>> On Saturday, June 21, 2014, Andrew McKinlay <[email protected]> >>>> wrote: >>>> >>>>> What's the difference between writing macros versus functions that >>>>> take `Expr` objects? Is there anything you can't do with a function that >>>>> takes expression objects? Are there any advantages of using macros beyond >>>>> no having to quote the code you pass as an argument? >>>>> >>>>
