> You never annotate a function signature unless you want to for documentation purposes.
so it sounds like function annotation is still an option for the purposes of communication, just no longer required in all cases.
[type Shape
[Circle f64]
[Rect f64 f64]
Point
]
[sig test_sig : Shape -> Float]
[fn test_sig [shape]
[match shape
[Circle r] [* 3.14159 [* r r]]
[Rect w h] [* w h]
Point 0.0
]
]
Unfortunately it seems like this doesn't currently work as expected when I use it in the playground, so I'm going to go file an issueI agree that seeing types is helpful, though typing them is also not necessary. Perhaps the solution is an IDE that shows you all the types inferred by the compiler or maybe a linter that adds comments with types on file save.
see "The Editor as Type Viewer" section in the docs: https://loonlang.com/concepts/invisible-types
Types exist so that the compiler can reason about your code better - but not incidentally, they also help you reason about your code better!
To wit: even when working in dynamic languages, it's often considered a good practice to write down in docstrings the types of objects a function can operate on, even without static enforcement. Thinking about types is helpful for humans, too.
And it's not even just a thing to help you read code in the future - types help me write code, because as I sit down to write a function I know the possible values and states and capabilities of the object I'm working with. In the best of cases I can analytically handle all the possible cases of the object, almost automatically - the code flows out of the structure of the type.
THIS. So much. This observation is extremely intuitive to me.