Assigning to ReadOnly properties

Brendan Eich brendan at mozilla.com
Mon Nov 26 21:20:43 PST 2007


On Nov 12, 2007, at 2:30 PM, Brendan Eich wrote:

> On Nov 12, 2007, at 1:43 PM, YR Chen wrote:
>
>> Out of curiosity, what other JS operations fail silently?
>
> Nothing as badly silent as assigning to a ReadOnly property, but  
> here I'll bitch about a similar change during ES1 standardization:  
> delete x => false if x is in the scope chain but bound with the  
> DontDelete attribute -- otherwise delete x => true, either if it  
> was found without DontDelete and therefore deleted -- or just not  
> found! So delete asdfewr => true. Same for any more qualified  
> reference, e.g. delete foo.bar when you mean foo.baz. Oh, and if  
> bar was found in a prototype object of foo, delete foo.bar => true  
> without doing anything!
>
> This all seems wrong, and IIRC in Netscape 2, JS1, the original  
> buggy progenitor language, delete would report an uncatchable error  
> on bad inputs. Just as assigning to ReadOnly would. Someone with an  
> old PC and Netscape 2 or 3, please confirm.

My memory failed me -- I was thinking of ReadOnly errors, which were  
indeed uncatchable errors in Netscape 2 and 3. There was no delete  
operator until Netscape 4, as far as I can tell now (but I can't rely  
on memory, which must mean something -- too much time has passed, or  
perhaps too much trauma from the pre-historic JS days ;-)).

/be



More information about the Es4-discuss mailing list