Makes sense. So if you want to generate a lot of code in your package (similar functions or types for example), then you might loop over @eval's, but if you want your user to also add the same kind of functions, then you might prefer to make a macro and export that.
On Thursday, September 3, 2015 at 9:34:26 AM UTC+2, Mauro 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 ( > [email protected] <javascript:>) 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 > >
