Question about joined function object of ECMA-262 3rd edition

Shijun He hax.sfo at gmail.com
Sun Aug 5 09:38:44 PDT 2007


I read your post again today. And I found the key point is the
definition of "Equated".

13.1.1
Both uses obtained their FunctionBody from the same location in the
source text of the same ECMAScript program. This source text consists
of global code and any contained function codes according to the
definitions in section 10.1.2.

Q1: what is "source text of the same ECMAScript program" or "this source text"?
Q2: what is global code and what is contained function codes?

Let's give a example here:

function A() {
  return function B(x) {
    return x * x;
  }
}
var b1 = A();
var b2 = A();

Is the "source text" means all code or just means "return x * x"?
I think it means all codes, then the global code of it is:
  function A() {...}
  var b1 = A();
  var b2 = A();
The contained function codes are:
  return function B(x) {...}
and
  return x * x;

You said: "if a nested function relies on the containing function, the code
it relies on is not part of either the global code or it's contained
function code"

So I don't understand it. Do you mean the source text should be "return x * x"?



More information about the Es4-discuss mailing list