Section 13.2: Rationale for "caller", "arguments" restriction

Jim Blandy jimb at
Thu May 28 01:17:04 PDT 2009

On 05/26/2009 06:05 PM, Mark S. Miller wrote:
> JavaScript has one and only one encapsulation mechanism -- functions 
> evaluating to closures that encapsulate their captured variables. 
> However, the existence of these de-facto properties pokes a fatal hole 
> in this mechanism, leaving us with no defensible boundary.
I appreciated the example on the slide you linked to.  Providing .caller 
does seem to be problematic.

However, what you wrote above confused me.  The things encapsulated by a 
closure are the variables it refers to from lexically enclosing scopes.  
What you wrote suggests that .caller somehow makes those available to 
others, which isn't so, as far as I can tell.  The closure's arguments 
can be obtained, but those are different.

The mechanism with the hole is the dynamic link, not the static link.

More information about the es-discuss mailing list