Russell Leggett wrote:
Can we make it writable:false, configurable:true? Of course, that would only be a minor deterrent from changing it around, but maybe just enough?

This has zero integrity, so is IMHO worse than worthless -- it's misleading. Not that anyone will count on it, but stopping assignments while allowing reconfiguration or deletion and redefinition does not smell right.

To answer Dave's question, I meant that classes without any extra Object.defineProperty calls can be used to implement built-ins. Not a huge win but seemingly better than requiring Object.defineProperty for that case -- assuming class declarations create a constructor property on the class prototype.

If we want class C {} to create no C.prototype.constructor back-link to C, then we're not sugaring the prototypal pattern. That seems like too much innovation instead of desugaring, but you could model it via delete C.prototype.constructor after class C{} assuming constructor is configurable.

Of course one could argue based on desugaring to user-defined (not built-in) functions that C.prototype.constructor should be configurable and writable:

js> function f(){}
js> Object.getOwnPropertyDescriptor(f, 'prototype')
({configurable:false, enumerable:false, value:{}, writable:true})
js> Object.getOwnPropertyDescriptor(f.prototype, 'constructor')
({configurable:true, enumerable:false, value:function f() {}, writable:true})

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

Reply via email to