Hacker News new | ask | show | jobs
by mrkeen 1309 days ago
> Does it end up creating new objects every time for e.g. a map is called like in this example to update all the attributes?

No. This is optimised away.

It's yet another reason why it's frustrating to see FP-like things bolted onto mainstream imperative stuff. You can't optimise away 'mostly functional' code. Wrapping a Set with an UnmodifiableSet isn't the same thing as (f x) + (f x) == 2 * (f x)