You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Savi compiler I have adopted this approach, with the small change that it uses the @ prefix to designate the concept of this. (everywhere it appears - not just in this particular feature).
:class Point
:varxF64:varyF64:newcreate(@x,@y)
So I endorse the "Alternative 1" approach above 👍,
though I'd also like to make the this. syntax be less verbose (probably in a separate RFC so as not to bog this one down in that controversy).
I'm not a fan of "Alternative 2" because it would make it more difficult to find the full list of the type's fields - especially if there are multiple constructors involved and not all of the fields appear as parameters in every constructor's signature.
Kotlin and Scala are additional examples which have adopted a feature like this, specifically closer to alternative 2 (and for Kotlin there is the primary constructor mechanism which makes this the norm and follows the presented constructor version)
Alternative 1, like Dart:
Alternative 2, like Python, Typescript
The text was updated successfully, but these errors were encountered: