[e-lang] E-on-JavaScript property mapping: fail on nonexistence?
Mark Miller
erights at gmail.com
Sun Aug 23 16:48:22 EDT 2009
On Sun, Aug 23, 2009 at 1:12 PM, David-Sarah Hopwood <
david-sarah at jacaranda.org> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.eros-os.org/pipermail/e-lang/attachments/20090823/1eeb5b76/attachment.html
More information about the e-lang
mailing list