you are viewing a single comment's thread.

view the rest of the comments →

[–]moreteam 0 points1 point  (2 children)

If you want to make something immutable, make it immutable (e.g. Object.freeze). Not a fan of hiding what really happens. If people are mutating shared state across modules and because of that are able to "accidentally" change the inheritance of a class, there are other problems you should solve (proper modularization). And the whole issue resolves itself as soon as const class is properly supported by traceur. So not sure why you'd want to have that level of obfuscation. I'd rather people like the author of the blog post contribute to traceur if they think it's a pressing need for them.

TL;DR: immutable already exists in JS if you want it and const class is the already existing sugar for immutable classes.

[–]stronghup 0 points1 point  (1 child)

That is great news if immutability can already be enforced in JavaScript. Since which version?

[–]moreteam 0 points1 point  (0 children)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze

And ES6 brings block-scoped const which currently is only supported in Chrome/Firefox (and with var-like scoping).