Consider implementing mutating properties and subscripts #1061
kyouko-taiga
started this conversation in
Language design
Replies: 1 comment 4 replies
-
I don't understand your example. It merely shows syntax for a declaration, but it doesn't show what usage that declaration would enable. If I had to guess, it would be something like
But IIUC, we will already allow that, synthesizing the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There is currently no way to declare a member subscript that mutates its receiver regardless of the variant that is used. Such a feature would be useful to implement projections of mutable pointers to the contents of a whole. For example:
It is actually possible to emulate this feature with free subscripts, which probably reveals that we have a gap to fill:
Beta Was this translation helpful? Give feedback.
All reactions