Allow writing to a field of a type in a union #4753
Memresable
started this conversation in
Proposals
Replies: 1 comment 1 reply
-
The So, doing If you actually want to assign 10 to the union value itself, you would need to do |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Suppose the following
Currently you can read
bar
, but you can't write to it, this seems inconsistent to me, I don't know the reason behind not allowing this because it seems like it shouldn't be much of a trouble to do so?I suppose you're literally just reading part of the union's memory through an offset which isn't that bad? (which I assume that's how reading works here) so what makes it not possible to write to a field then?
Beta Was this translation helpful? Give feedback.
All reactions