I think you just need to remove the eval() from your macro. Macros should always return Expr (expression) objects, and not be in the business of eval-ing things.
-Jacob On Mon, Aug 11, 2014 at 7:16 AM, Philippe Maincon < philippe.main...@gmail.com> wrote: > Hi, > > Within a module, I am defining a macro, and then calling it multiple time > to generate a bunch of functions. > > I would like to make these functions available to the user of the macro, > so I should export them. My macro now looks like > > macro Op1(OP,A) > > eval(quote > > $OP(a::Dual) = Dual($OP(a.x),a.dx*$A,a.id) > > export $OP # code line 72 > > end) > > end > > > (yes, I am still playing with automatic differentiation...) but on executing > the module file I get > > LoadError("P:/Programming/Julia/autodiff9.jl",72,ErrorException("unsupported > or misplaced expression export")) > > > Can I somehow automatise the exporting of function using the macro as I > attempt in the code above, or do I need to explicity export each function > that I create via macro? > > > Philippe > > >