Why is this so hard? Why do we need unnecessary OOP abstractions.
Use functions, it's really really simple. https://gist.github.com/4255961 ```js function Base(text) { return function () { return text } } function Derived(source, prefix) { var text = Base(source) return function () { return prefix + text() + prefix } } function Derived2(source, prefix, color) { var text = Derived(source, prefix) return function () { return color + text() } } var d = Derived('foo', '!'), d2 = Derived2('bar', '!', 'red'), assert = require('assert'); assert.equal( d(), '!foo!' ); assert.equal( d2(), 'red!bar!' ); ``` On Mon, Dec 10, 2012 at 4:41 PM, Azer Koçulu <a...@kodfabrik.com> wrote: > I re-wrote your example using a new library that I'm working on; > > https://gist.github.com/4254699 > > Here is another example: https://gist.github.com/4136102 > > And this is the library: http://github.com/azer/ak47 > > > On Mon, Dec 10, 2012 at 8:05 AM, Alexey Petrushin < > alexey.petrus...@gmail.com> wrote: > >> I wrote short article about Functional Mixins with simple example, maybe >> it will be useful http://petrush.in/blog/2012/functional-mixins >> >> >> On Wednesday, November 7, 2012 6:32:04 AM UTC+4, José F. Romaniello wrote: >>> >>> I really like this functional mixins thing, another good read is this one >>> >>> http://killdream.github.com/**blog/2011/10/understanding-** >>> javascript-oop/<http://killdream.github.com/blog/2011/10/understanding-javascript-oop/> >>> >> -- >> 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 nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> > > -- > 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 nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en