Extend with
to include immutable indexed collections
#3474
Unanswered
cgranade
asked this question in
Language Ideas
Replies: 2 comments
-
Is being able to set a specific value actually useful, if you can't use a similar syntax for even such basic operations as adding or removing items? That doesn't fell very consistent to me. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can already use .SetItem() to "modify" an item in an Immutable collection |
Beta Was this translation helpful? Give feedback.
0 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.
-
I was recently very excited to see the new
with
expresion for working with immutable record types, and wanted to suggest extending this new feature to include set-and-replace operations on immutable list and dictionary items as well. For example:We use a similar syntax in Q# for immutable array set-and-replace operations (e.g.:
ConstantArray(4, "I") w/ 1 <- "X"
is the array["I", "X", "I", "I"]
) and have found it to be a really useful feature.Beta Was this translation helpful? Give feedback.
All reactions