Do you put return type in function definitions?

That’s right. Converting from Vector to AbstractVector has no actual effect, so the annotation becomes just a type assertion.

That’s not really what return-type annotations are for. Just use comments or docstrings.

disagree on this. comments are not checked, type annotations are.

2 Likes

I was responding to a comment about using return-type declarations to “clarify”, i.e. document.

And return-type annotations are “enforced” by calling convert in Julia, which means that they aren’t necessarily a validation mechanism — they can hide a type-instability.