3 ms·
I like the idea of unified call syntax. I know D and Nimrod support a system similar to the one proposed here, albeit they were designed with the syntax from th
by adrusi 12y ago
I like the idea of unified call syntax. I know D and Nimrod support a system similar to the one proposed here, albeit they were designed with the syntax from the start and avoid the more awkward edge cases.
If it can be proven not to break existing code, I think it would be a positive addition to the language. I worry, however, that there might be some confusion. I imagine seeing x.a().b().c() where you expect c(b(a(x))) would throw you off.
An alternative worth considering is what Kotlin calls extension methods (and I'm sure I've seen the idea elsewhere). The idea is you could declare a member or non-member function to always be called with either call syntax. This eliminates the burden on the programmer of choosing which syntax to use, eliminates a lot of edge cases, but doesn't give the same flexibilty as the unified syntax.