"applicable method may be too new" error

Interesting, thanks, I had not seen that section. And if you attempt to use the workaround using a closure mentioned there, it doesn’t work because inside a @generated function (in 0.6 at least) you can’t have a closure.

julia> @generated function foo()
           quote
              global bar() = "hi"
              res = eval(Expr(:call,
                  function()
                      return bar()
                  end))
              return res
           end
       end
foo (generic function with 1 method)

julia> foo()
ERROR: generated function body is not pure. this likely means it contains a closure or comprehension.

So I suppose this is just not possible?

1 Like