Replies: 4 comments 2 replies
-
|
please no.. its unnecessary complicated and it does not improve readability nor does it reduce repitition.. the only thing it add is extra block of indentation.. current way of declaring methods is the best way to do it and its allow extension function like in Kotlin |
Beta Was this translation helpful? Give feedback.
-
|
Kotlin: is "type last" -> extention functions have less impact on readability. |
Beta Was this translation helpful? Give feedback.
-
|
It's deliberately not inside of such a construct. Usually something like that is constructed to emphasise that the methods form a closed set. That is, method additions are closed. C3 is completely the opposite, where you can add methods to anything anywhere. Want to add a function to Even if it can be made to work, there is the clear downside when extending: impl Foo
{
fn void abc(self) { ... }
}When I could have written fn void Foo.abc(self) { ... }So in terms of "nudging", having "Impl" encourages thinking of methods as a closed set, whereas the current encourages thinking of methods as an open set. The latter is desirable. On top of this it also introduces a namespace-y construct to the C syntax, which is a complexity cost. Again, if the methods were closed, then this would make sense, but they're not. |
Beta Was this translation helpful? Give feedback.
-
|
Although the syntax is still a bit confusing (readability) in this case it makes sense. Thanks for exmplenations. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
have you considered to implement the struct methods like in rust? IMO this would improve the readability of functions a lot and reduce repetition. (please see example)
Beta Was this translation helpful? Give feedback.
All reactions