Omit readonly keyword on injected fields?
#12580
Unanswered
paul-marechal
asked this question in
General
Replies: 1 comment 3 replies
-
|
I would disagree with this: read-only fields are not supposed to change after initialisation. This makes it easier to argue about state transitions of an object. That we work around this for testing, etc. does not make the point invalid, IMO. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Looking at https://github.com/eclipse-theia/theia/wiki/Coding-Guidelines there isn't any guideline for injected field definition in classes.
I propose to get rid of
readonlymodifiers on injected field for the following reasons:anyor anything else to write to the field.Beta Was this translation helpful? Give feedback.
All reactions