Array Generics and null

Erik Arvidsson erik.arvidsson at
Mon Mar 31 09:29:54 PDT 2008

I agree with Lars (and Mark) on this.  It would be best if access to 'this'
would throw.  Throwing in the actual call to the function seems a bit harsh
since the statement that refers to 'this' might never be reached.  Making
the access throw would allow people to at least catch the error and fall
back on some other behavior.

My vote goes to throwing an exception when a non provided this is accessed.

On Sun, Mar 30, 2008 at 07:27, Mark S. Miller <erights at> wrote:

> On Sun, Mar 30, 2008 at 6:54 AM, Lars Hansen <lhansen at> wrote:
> >  The third option on the table is that the reference to 'this'
> >  inside the body of topLevel simply throws an error.  This has
> >  both less and more utility: the function can't discover if it
> >  was called as a function or as a method; but functions that
> >  simply assume they were called as methods will fail earlier.
> Since the example function here is called "topLevel", I'd like to
> remind everyone that the constraint we're talking about would apply to
> all functions -- the lexical "this propagation" rule is dead.
> Regarding the choices,
> * "undefined" is more uniform and easier to explain.
> * Throwing an exception is safer.
> * Even safer would be that a function that mentions "this" is
> considered a method, and an attempt to call it as a function throws
> without ever entering the function.
> Caja currently does the last. I'm happy with any of these choices.
> --
>  Cheers,
>  --MarkM
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Es4-discuss mailing list