What does "as if by the expression" mean in ES3?

Mark S. Miller erights at google.com
Thu Jun 19 17:14:56 PDT 2008


For example, in ES3

11.1.4 Array Initializer
...
1. Create a new array as if by the expression new Array().
...

The phrase "as if by the expression" followed by a literal snippet of
code occurs repeatedly in ES3. I know that ES4 prevents assignment to
the various global variable names used by such code, but what about
shadowing lexical variable definitions? FF 2.0.0.14 on squarefree does
seem to obey the literal reading of the ES3 spec -- that shadowing
affects array and object literals:

(function foo(){
  function Array(){return Date;}
  function Object(){return window;}
  return new window.Array([1,2],{bar:3});
})();
function Date() { [native code] },[object Window]

Safari literals are not affected by such shadowing definitions. Which
behavior does ES4 consider correct?


-- 
    Cheers,
    --MarkM



More information about the Es4-discuss mailing list