Pragmas

Peter Hall peter.hall at memorphic.com
Mon Nov 12 10:18:49 PST 2007


What is the scope of a pragma such as that? Is it just the current
lexical scope, like a "use namespace" statement, or does it change the
behaviour for the entire program? If it's the latter, isn't there a
compatibility problem between libraries? If it's the former, do you
anticipate that es4 programs will be littered with "use strict"
pragmas? Think Fortran and "implicit none"....

I assume this has been previously discussed, but I couldn't find it,
so apologies if that is the case.

Peter


On 11/12/07, Brendan Eich <brendan at mozilla.org> wrote:
> On Nov 12, 2007, at 9:00 AM, Jonathan Watt wrote:
>
> > Hi,
> >
> > 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
>
> or perhaps
>
>    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
> property. Comments?
>
> /be
>
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
>



More information about the Es4-discuss mailing list