On Feb 11, 2008 3:16 AM, DK <[EMAIL PROTECTED]> wrote:

>
> if Enumerable was a class. But it isn't!


It's never going to be a class; it was supposed to be a module like in Ruby
language, which is then mixed in certain classes that define _each to get
enumerable goodness.

But with prototypal inheritance in JavaScript that is simply impossible. A
prototype chain is one-dimensional - each object can only inherit from one
prototype. So if an object is already an instance of Hash (for example), it
cannot have dynamic inheritance from Enumerable module. We can only copy
enumerable functions to it. When new functions get added to Enumerable, they
have to be synced manually with target classes.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to