On Oct 17, 7:35 am, Tomasz Kalkosiński <[EMAIL PROTECTED]>
wrote:
> Hey guys.
>
> For Enumerable, according to API Docs I've found: If there is no
> context argument, the iterator function will preserve the scope it
> would have anyway.

Sorry, that's just a poor wording on our side : /
By "preserve scope it would have anyway" it was probably meant that a
function is not explicitly "bound" to any object.
What actually happens is simple. The function (e.g. `Enumerable.each`)
always invokes its iterator via `apply` (passing it an explicit
`context` argument). When that `context` argument is `undefined`,
function is called within a global context (see 15.3.4.3 in ecma-262
specs).

The way you understood binding in this case is actually pretty
intuitive to many people. The problem is that callee has nothing to do
with caller's context (at the moment when it's being called). Caller's
context is never preserved when callee enters its own execution
context. There's not much we can do to make it work the way you
describe : )

[snip]

>
> Greetings,
> Tomasz Kalkosiński

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to