Hacker News new | ask | show | jobs
by Sonata 3915 days ago
I really hope immutable collections get added to the standard library eventually (probably ES2017 at this rate). Proxies should allow them to be used with libraries which expect mutable objects and arrays, as long as they don't mutate them.

Having them built in to the language would open up some interesting new possibilities too. It should be possible to send immutable data between Worker threads without the overhead of serialization and deserialization, which is currently one of the main barriers to doing heavy computation in a web worker rather than on the UI thread. Of course, there would be some nasty internal implementation details to sort out, as it would require sharing heaps, but it should be possible.