Mark Miller erights at gmail.com
Mon Nov 12 09:40:17 PST 2007

On Nov 12, 2007 9:05 AM, Brendan Eich <brendan at mozilla.org> wrote:
> [..], but the idea would
> be to enable throwing of a ReadOnlyError on assignment to a ReadOnly

Hi Brendan,

I'm glad to hear that this possibility is in scope. In the Caja spec, we write:

\item[Silent errors.] In JavaScript, various operations, such as setting a
ReadOnly property, fail silently rather than throwing an error. Program
logic then proceeds along normal control flow paths premised on the
assumption that these operations succeeded, leading to inconsistency. To
program defensively in the face of this hazard, every assignment would be
followed by a \emph{did it really happen?}'' test. This would render
programs unreadable and unmaintainable. Where practical, Caja deviates from
standard JavaScript by throwing an exception rather than failing silently.

For defensive consistency (as defined in my thesis) to be practical, I
believe this change is necessary. I also believe that defensive
consistency (or some close relative) is necessary for secure
programming. Caja goes to a lot of trouble to achieve this while
running on an ES3 platform. If ES4 made this change, it might make
Caja's future life easier.

--
Text by me above is hereby placed in the public domain

Cheers,
--MarkM