Semantics of :: in return type vs. argument type annotations

It’s more similar to a local-variable declaration. If you declare local x::T, then assignments x = y call convert(T, y).

(This was the motivation for the behavior, in fact, as discussed in add `function f()::T` return type declaration syntax by JeffBezanson · Pull Request #16432 · JuliaLang/julia · GitHub)

7 Likes