On Nov 16, 2:58 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: [...] > Another interresting point is usage of "early or late binding" when > calling methods from other methods within the same closure > (i.e.http://gist.github.com/25430) > Early binding makes Prototype methods sort of frozen, but it looses > some dynamism.
In your first example: function delay(timeout) { var args = slice.call(arguments, 1); __method = curry.apply(this, args); return window.setTimeout(__method, timeout * 1000); } Where is `curry` "taken from"? Is it an "original" `curry` stored somewhere in a closure? > Another better example is Enumerable, when all methods are written in > term of `each` or an higher-level iterator. > Should we write `this.each(...)` in `collect` code, or `each.call > (this, ...)` ? If we use original `each` in `collect` and then I "wrap" `each` to log its arguments, it would be surprising not to see `collect` logging my arguments (as it is calling original `each`, rather than the one I modified : )) > `_each` being the only method that really has to be late-bound. > > Best, > Samuel Lebeau [...] -- kangax --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---