Annotate return type for anonymous function & lambdas

question

#1

Is it possible to add return types for anonymous function & lambdas?

The followings don’t work

    function ()::Int
        1
    end
()::Int -> 1

#2

I’m not sure I’m understanding your question correctly, but if you want to annonate the type of the value returned by an anonymous function, then you could either do:

julia> myanonfun1 = function ()
           1::Int
       end
(::#1) (generic function with 1 method)

julia> myanonfun1()
1

or else:

julia> myanonfun2 = ()->(1::Int)
(::#5) (generic function with 1 method)

julia> myanonfun2()
1

#3

Looks like a parser bug