`eval` (typically) isn't allowed to handle `import` and `export`
statements. those must be written explicitly

On Thu, Mar 26, 2015 at 8:18 AM Amit Murthy <[email protected]> wrote:

> I was trying to add a bunch  of common functions to DistributedArrays.jl
> with the below code block
>
> for f in [:sum, :minimum, :maximum, :mean]
>     @eval begin
>         import Base: ($f)
>         export ($f)
>         function ($f)(D::DArray)
>             refs = [@spawnat p ($f)(localpart(D)) for p in procs(D)]
>             ($f)([fetch(r) for r in refs])
>         end
>     end
> end
>
>
>
> But I get an error
>
> ERROR: LoadError: syntax: invalid "import" statement: expected identifier
>  in include at ./boot.jl:250
>  in include_from_node1 at ./loading.jl:129
>  in reload_path at ./loading.jl:153
>  in _require at ./loading.jl:68
>  in require at ./loading.jl:51
>  in process_options at ./client.jl:292
>  in _start at ./client.jl:402
> while loading /home/amitm/.julia/v0.4/DistributedArrays/src/
> DistributedArrays.jl, in expression starting on line 497
>
>
>
> What am I doing wrong ?
>
>

Reply via email to