> you want to freeze everything *.empty

I don't think most of those *need* to be frozen, per se, since they're already 
immutable: `Function`, `String`, `Number`, `Boolean`, `RegExp`, … all immutable 
themselves. `Array.prototype` is however mutable 
(`Array.prototype.push(1,2,3)`), so freezing it from mutation is an extra step 
of caution you might want to take.

FWIW, I've used `Array.prototype` as an empty array in quite a few cases, and 
never actually run across one where it got mutated. *That* part is currently 
just theory, I think.

> you can’t freeze Array.prototype.

I think what he meant was, freezing Array.prototype would both prevent it from 
being mutated, but also prevent it from being extended 
(Array.prototype.superCool = ..). That seems, to me anyway, as a negative. So 
in support of Axel's argument, an `Array.empty` *could* definitely be frozen, 
if it were separate, without affecting `Array.prototype` extensibility.



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to