My proposal is very simple:
var Animal = Class.create(instanceMethods, classMethods)
Both arguments are hashes of methods and the second argument is optional.
There are *no* magic properties in them (like include, extends, mixin) -
every key-value pair becomes a regular method. The only "magic" property
still remains "initialize", which is the constructor by convention.
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.
Other OO stuff:
So you see, I want to contain everything in "Class". By doing this we
simplify inheritance support code, greatly reduce the risk of collision and
ensure everybody is aware of what are they doing.
And the name of the superchaining method (by my order of preference):
I vote against:
- parent (naming collisions)
- base (ugh!)
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
- leave room for users to make their own additions to the inheritance
- no dollar-signs and underscores because they indicate bad design
(exceptions from this rule are $super/$parent)
- 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
alias :peach, :each
super + ["birds", "gold fishes"]
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to email@example.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at