> Subclassing:
>
> var Cat = Class.extend(Animal, instanceMethods, classMethods)
>
> This is much smarter than "Animal.extend(...)" because you may wish to have
> a class method named "extend" on your classes.
Agreed. though I think the Class.create({Extend: Animal, ... })
syntax suggested earlier is interesting if we intend to go the magical
property way.
>
> Other OO stuff:
>
> Class.include(Animal, Enumerable)
> Class.alias(Animal, ...)
How do you handle precedende handled between mixin and instance
methods ?
> And the name of the superchaining method (by my order of preference):
>
> 1. sup
> 2. $super
> 3. $parent
fine by me.
> I vote against:
>
> - parent (naming collisions)
> - base (ugh!)
> - uber
>
> In conclusion, my philosophy is:
>
> - no magic properties except "initialize"
> - keep the inheritance support code simple and short, otherwise it
> makes no sense in having it
Well, I'm not convinced about that. A proper an easy way to include
mixins and aliases is simple to implement, clean and a pleasure to
use.
> - leave room for users to make their own additions to the inheritance
> support code
> - no dollar-signs and underscores because they indicate bad design
> (exceptions from this rule are $super/$parent)
how so ?
> - don't try to make defining of classes look like you're writing Ruby,
> it simply won't work.
>
> This is some class definition in Ruby:
>
> class Cat < Animal
> include Enumerable
> alias :peach, :each
>
> def say
> "meow!"
> end
>
> def self.food
> super + ["birds", "gold fishes"]
> end
> end
>
> You can't achieve this in JavaScript. Simply let it go.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---