The @deprecate macro
<https://github.com/JuliaLang/julia/blob/517f87267468752b28490191d8e1f6b1a6da01c2/base/deprecated.jl#L5-L11>
is
a good example of how to do this.


On Fri, Sep 5, 2014 at 4:06 PM, John Myles White <[email protected]>
wrote:

> It is definitely possible. You just need to use toplevel, which is a magic
> that Jeff doesn't want people to know about.
>
>  -- John
>
> On Sep 5, 2014, at 12:52 PM, Ben Arthur <[email protected]> wrote:
>
> sorry to resurrect this old post, but what is the definitive answer to
> whether it's possible to "@eval export ..."    sure would be handy.
>
> On Monday, December 3, 2012 1:04:27 PM UTC-5, Stefan Karpinski wrote:
>>
>> I'm not sure if this is possible (Jeff will have to answer that), but I
>> would say that explicitly writing "export a, b, c, d" seems like the way to
>> go.
>>
>>
>> On Mon, Dec 3, 2012 at 12:51 PM, Avik Sengupta <[email protected]>
>> wrote:
>>
>>> I was wondering how to export functions whose names are defined using an
>>> eval. The following simplified code produces a "syntax error: invalid
>>> export statement" . How can I fix that?  Without the @eval export.... , the
>>> functions are properly defined and accessible via the namespace.
>>>
>>> module X;
>>> using Base;
>>>  for name in (:a,:b,:c,:d);
>>>        @eval global $name
>>>        @eval function ($name)()
>>>                return true
>>>        end
>>>       @eval export ($name)
>>> end
>>> end
>>>
>>> --
>>>
>>>
>>>
>>
>>
>

Reply via email to