future
future copied to clipboard
Arity checking is fragile
Ripping out the arity of the quoted argument is a very fragile way to get the arity.
https://github.com/eproxus/future/blob/master/lib/future.ex#L30
For example this will fail:
test "passing something that we cannot find arity of" do
x = &hello/2
Future.new(x)
end
The solution is push the arity into the quoted code. Just need to workout how to manually replace unquote_splicing.
I will continue playing with that.
Adding arity attibute is a dumb solution? (at least as fallback) Better unquote_splicing may help, but it might not work if the "x" is passed as function arguments, etc.?
defmacro new(fun, arity) do
wrap_fun(fun, arity)
end