Array Generics and null

Mark S. Miller erights at google.com
Sun Mar 30 07:27:16 PDT 2008


On Sun, Mar 30, 2008 at 6:54 AM, Lars Hansen <lhansen at adobe.com> 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



More information about the Es4-discuss mailing list