The rationale for strict mode

Mark S. Miller erights at google.com
Thu Nov 13 16:07:47 PST 2008


On Thu, Nov 13, 2008 at 2:53 PM, David-Sarah Hopwood <
david.hopwood at industrial-designers.co.uk> wrote:

> [...] Strict mode reports many
>   error conditions, such as accessing a non-existent property of an
>   object, by throwing an exception. In non-strict mode these
>   conditions silently cause the operation to be ignored or the
>   'undefined' value to be used as the result. [...]<https://mail.mozilla.org/listinfo/es3.x-discuss>
>

Hi David-Sarah, I like everything about your message, except that the above
example specifically is incorrect. Because the JavaScript "feature testing"
pattern is so ingrained, and because the failure does manifest in an
undefined value which is likely to be noticed, strict mode does not change
the behavior of a failed read. For the same reasons, neither does Caja.

If you change your example to a failed assignment, everything works.

-- 
   Cheers,
   --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20081113/46640fa5/attachment.html>


More information about the Es-discuss mailing list