-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add initial array adr #362
base: main
Are you sure you want to change the base?
Conversation
045bd43
to
ae7ea73
Compare
ae7ea73
to
c25f315
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Think this is a great encapsulation of the conversation! I have a small suggestion to capture the fact that this decision was made with front-end support in mind.
// pass to subroutine, does not require additional complexity to support this | ||
someReadonlyFunction(arr); | ||
// for a subroutine to return a modified array, it must be an explicitly returned value | ||
arr = someFunctionThatMutates(arr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be arr2 = someFunctionThatMutates(arr);
if arr
is immutable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value assigned to arr
is immutable, but the variable arr
is not defined as const
so can be reassigned like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arr
is correct here. Being immutable does not prevent reassignment. For example strings and numbers are already immutable. It doesn't prevent you from writing a = a + b
to update a
.
Collaboration with @daniel-makerx to create an Array ADR based on the discussions we've had thus far.