I would like to define a struct where one of the field is a function. But I would also like to control the arguments and return type of that fonction. For the sake of the example, let say that function would match this signature : ::Int -> ::Float64
Currently I use the following struct that is too permissive to my taste
struct MyType
my_function::Function
end
Is there any way to inforce the signature of `my_function` in Julia (v0.6)?
It would be really nice if FunctionWrappers were in Base. Very few people would have the expertise to write that package, so it would be nice if there were some sort of maintenance guarantee built in to it. As far as I know, there is no other way to do that kind of super-efficient unboxing of functions in Julia.