On Dec 9, 2008, at 3:23 AM, Michael Day wrote:

Functions are mutable objects and could perhaps gain a potential speed boost in some circumstances by being immutable. But that could be achieved by a generic mechanism for making immutable objects, and does not require introducing a new type of function.

ES3.1 has Object.freeze, but you have to call it. This is ineffecient and slightly hazardous, compared to a declarative form that makes an immutable function from the start. The other advantage, of course, is better syntactic UI -- sweet sugar. Opinions vary on what's sweet, but

function dontMessWithMe() { ... }
Object.freeze(dontMessWithMe);

is not, especially if you do it hundreds of times (because you want almost all your functions to be immutable).

/be
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to