How to exactly lock the type of the arguments of a function?

Type assertions in function arguments only restrict dispatch. They are not like a type assertion inside of a function or for a global variable.

You’ve asked a similar question (with a related answer from me and @Vasily_Pisarev , as well as a link to an answer by Stefan Karpinski on Stackoverflow on the difference between struct fields and dispatch) a few days ago, was it not clear enough? Have you read through the manual? If you haven’t, I really recommend doing so - it may seem long & daunting, but I think it will clear up a lot of confusion you seem to have about how julia works. It’s best to acknowledge that Julia is not Fortran but rather its own thing.

3 Likes