The following seems like a bug, but maybe there is something I am missing about eval and parse that is causing the failure.
I define anonymous function and pass it as a parameter to another function. The code works when the anonymous function is defined directly as lambda, but fails when it is defined with parse and eval.
Contest of my file “test_func.jl”
function foo1() return (x,y)->(x==y) end function foo2() return eval(parse("(x,y) -> (x==y)")) end function foo3(f, x,y) f(x,y) end # this works with function defined directly as lambda in foo1 f1=foo1() foo3(f1,1,2) foo3(foo1(),1,2) # this works with foo2 returning a function defined with parse and eval f2=foo2() foo3(f2,1,2) # this fails with the parse and eval defined function passed directly as parameter to another function foo3(foo2(),1,2)
This is with master from build today.
_ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_) | Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.6.0-pre.beta.180 (2017-04-16 23:46 UTC) _/ |\__'_|_|_|\__'_| | Commit 934e0e3 (0 days old master) |__/ | x86_64-linux-gnu julia> include("test_func.jl") ERROR: LoadError: MethodError: no method matching (::##5#6)(::Int64, ::Int64) The applicable method may be too new: running in world age 21669, while current world is 21670. Closest candidates are: #5(::Any, ::Any) at none:1 (method too new to be called from this world context.)