Assigning to ReadOnly properties
brendan at mozilla.org
Mon Nov 12 09:05:21 PST 2007
On Nov 12, 2007, at 9:00 AM, Jonathan Watt wrote:
> As I understand it the reason assignment to ReadOnly properties
> fails silently
> is that there was no try-catch prior to ECMAScript 3.
Right. Netscape 2 reported a fatal error, but during ES1
standardization we agreed to go with silence is (golden|deadly).
> Could/will edition 4 require an exception to be thrown in strict mode?
Overtly incompatible, also highly desirable. So opt-in versioning
could enable this, but it's one more migration headache (see recent
exchange between Mark Miller and myself). An alternative would be a
pragma of some sort:
use readonly error
use readonly throw
We try to make pragmas more readable, sometimes with an extra word;
not sure this is the best way to phrase it still, but the idea would
be to enable throwing of a ReadOnlyError on assignment to a ReadOnly
More information about the Es4-discuss