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
a. Add a writable/write keyword that can be applied on fields, similar to readonly on structs. The downside is that is another keyword, when we already have readonly.
b. All fields are writable by default, and readonly can be used to override.
c. Interface fields can't be modified at all. Mutation requires a setter (e.g. setFoo()).
Note that requiring fields to be writable makes the interface harder to implement. If a struct has a field readonly foo, it can't implement any interface that requires foo. Option B implicitly makes this too restrictive.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
writable/writekeyword that can be applied on fields, similar toreadonlyon structs. The downside is that is another keyword, when we already havereadonly.readonlycan be used to override.setFoo()).Note that requiring fields to be writable makes the interface harder to implement. If a struct has a field
readonly foo, it can't implement any interface that requiresfoo. Option B implicitly makes this too restrictive.All reactions