Re: E-on-JavaScript property mapping: fail on nonexistence?

Mark Miller <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
On Sun, Aug 23, 2009 at 1:12 PM, David-Sarah Hopwood <
[email protected]> wrote:

> Kevin Reid wrote:
> > In E-on-JavaScript, when in Cajita mode, object["foo"] accesses the
> > foo property of object. Should it throw if the property does not
> > exist,
>
> Yes. It's E-on-JavaScript, so E's philosophy about avoiding silent
> failures applies.


I agree.


> Cajita would throw if not for the constraint of
> being a fail-stop subset of ECMAScript.


Actually, that would be allowed within the definition of fail stop. However,
we don't because the "feature testing" pattern -- "if (foo.bar) {
foo.bar(...); }" is way too common, and, like a failed side effect, a read
resulting in an undefined is likely to be noticed. This is the same reason
that ES5-strict chose not to throw for failed reads but does throw for many
other failures.

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

   Cheers,
   --MarkM

_______________________________________________
e-lang mailing list
[email protected]
http://www.eros-os.org/mailman/listinfo/e-lang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.