> And in which way can you skip this in normal prototype inheritance?
Not sure what do You mean, with functional mixins You can skip long
prototype chains, there are always only one prototype in the chain. Methods
assembled with applying set of function/mixins to it.
// Declaring mixins.
Persistence = fn(klass){
// Sort-of class-level / singleton method.
klass.findByName = fn(){}
// Object - level method.
klass.prototype.save = fn(){}
}
// Model
Model = fn(){}
// Injecting mixins.
Persistence(Model)
Validations(Model)
So, there's no need for long prototype chains.
It actually more advanced than prototypical because allows multiple
inheritance and inheriting both class-level and obj-level methods.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" 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/nodejs?hl=en?hl=en