3 ms·
It seems like this is proposing syntactic sugar to make mutating and non-mutating operations be on equal footing. > The more interesting example is reassigning
by hatthew 6mo ago
It seems like this is proposing syntactic sugar to make mutating and non-mutating operations be on equal footing.
> The more interesting example is reassigning the deeply nested l to make the cat inside older, without mutating the original cat
Isn't that mutating l, though? If you're concerned about mutating cat, shouldn't you be concerned about mutating l?
- two_handfuls 6mo agoIt doesn't mutate l exactly, it makes a new list slightly different from the original one and assigns it to l. That means if someone has a reference to the original l, they do not see the change (because l is immutable. Both of them).
- deleted 6mo ago[deleted]
- hatthew 6mo agoI think I am misunderstanding the behavior of the alt keyword