There is no way of declaring the return type of a function. See https://github.com/JuliaLang/julia/issues/1090
But it would be nice if there was. Nor is there a way to dispatch on the input argument types of functions: say you only want to accept functions with signature (::Int, ::Float64). You can annotate the callback with ::T to assert that it returns the right type. function myFunc( someArg::Int64, callbackFn::Function ) # do something # then call callbackFn callbackFn( <args> )::Int64 end On Thu, 2014-02-20 at 10:49, [email protected] wrote: > Hello, > > I am trying to find out how to specify the type of a callback function, for > example suppose > > function myFunc( someArg::Int64, callbackFn ) > # do something > # then call callbackFn > callbackFn( <args> ) > end > > I would like to specify the type of callbackFn, for example returning Int64 > and taking a tuple as arguments. > I looked at the docs but maybe I missed it, but which is the syntax for > specifying a function type? > > Thanks.
