Assigning to ReadOnly properties

Brendan Eich brendan at mozilla.org
Mon Nov 12 16:25:36 PST 2007


On Nov 12, 2007, at 4:01 PM, Mark Miller wrote:

> To fix delete within this constraint, "delete <whatever>" in Caja
> either return true or throws.

At this point, either ES4 slides down the slippery slope a bit and  
courts migration pain that holds it back (we really do expect most  
pages on the web today to work if shipped as application/ 
ecmascript;version=4 or application/javascript;version=2); or I think  
we need a better pragma story.

We could support

   use DeleteError, ReadOnlyError

and encourage users to litter their new code with this line at the  
top. There's good precedent from Perl and other languages for a  
superstitious

   use strict

at the top. But the Errors are a mouthful and eyeful. Since I just  
mentioned strict mode, I'll note again that the single runtime  
semantic change strict mode causes from standard mode (assuming the  
program passes strict mode's type checker and lint-like sanity  
checker) is a change to eval: strict mode results in a different  
runtime eval, such that eval cannot create bindings in its dynamic  
scope. We could slide down *this* slope a bit by adding DeleteError  
and ReadOnlyError exception behavior to 'use strict'.

Comments welcome, but you're probably in favor of opt-in versioning  
making all of these changes implicitly ;-). Or perhaps a 'use Caja'  
pragma :-P.

/be



More information about the Es4-discuss mailing list