> Ok, makes sense. For what it’s worth (I’m very new at Julia, but have
> been using Lisp/Scheme/Clojure for a while now)… In Lisp/Clojure I
> think there’s a preference even for internal function definitions to
> use macros vs eval for the reason that macros modify the source at
> parse time, but eval will only have its effect once interpretation has
> begun. This distinction can be important for tools that operate on
> code (linters, static analyzers, and such).

Interesting, not sure what Lint.jl prefers.  In Base, the style is to use
eval in such situations.

> On September 3, 2015 at 10:34:27, Mauro (mauro...@runbox.com) wrote:
>
>> Out of curiosity, why use `@eval` directly instead of defining a  
>> macro? (I’m just trying to get a better feel for what’s more Julian.)  
>
> Generally:  
> Use eval when you want to generate code at a particular location.  
> Conversely, macros are used if you want to provide a way for your users  
> to generate code in a certain way (that you specify) in their own code.  
>
>> On September 2, 2015 at 12:44:39, Patrick Kofod Mogensen 
>> (patrick.mogen...@gmail.com) wrote:  
>>  
>> I'm in a train right now, but yes. Look up metaprogramming in the docs, or 
>> look at the blog entry on refactoring code in Twitter.jl 
>> http://randyzwitch.com/julia-metaprogramming-refactoring  

Reply via email to