Type Signatures for Functions #5987
Replies: 4 comments 7 replies
-
I completely agree that the proposed syntax will make maintenance easier. Our functions in Enso tend to take a lot of arguments, so having some correspondence between the actual arguments and their types will be very useful. Currently, signatures with 5+ arguments are just hard to read too - because I have to count which type label refers to which argument. The proposed solution will not only be more maintainable, but also more readable. |
Beta Was this translation helpful? Give feedback.
-
The proposed syntax seems less Haskell-like and more Scala-like. Parser shalln't have problem supporting the new syntax. Personally I don't like the return syntax as Anyway the current syntax is errorprone I just had to fix one such error in my code: 74691a7 - it is so easy to get the arity wrong! |
Beta Was this translation helpful? Give feedback.
-
I like the proposed syntax, it matches well IMO the design of the language. Let's do it :) |
Beta Was this translation helpful? Give feedback.
-
The classical syntax |
Beta Was this translation helpful? Give feedback.
-
Having just cleared up a load of mismatch function type signatures the question occurs on whether we should review.
Currently we have:
When we add or reorder parameters this can easily get out of line (see #5979).
We also have the option of pairing the parameters and the type:
However, this lacks the ability to have a return type specified, but does pair the type and parameters together making maintenance easier. My suggestion would be that we expand this syntax a little further to include a return type:
This would make keeping them in-line simpler and cleaner.
What do people think? cc: @radeusgd @JaroslavTulach @sylwiabr @wdanilo
Beta Was this translation helpful? Give feedback.
All reactions