News for hackers. Stuff that matters.
Re:Google SoundScript: faster OOP for JavaScript by greggman on Wednesday February 04, 2015 @03:42PM (#8999604)
I'm not. See above, "class free object oriented programming". You don't need prototypical inheritance to have inheritance in JavaScript. Crockford gives examples. You don't need the "class" keyword. All it's going to do is steer people in the wrong direction.
Re:Google SoundScript: faster OOP for JavaScript by Touche on Wednesday February 04, 2015 @03:52PM (#8999678)
Can you give an example of inheritance without prototypes in javascript?
Re:Google SoundScript: faster OOP for JavaScript by greggman on Wednesday February 04, 2015 @04:19PM (#8999897)
from D.C.

    function base(spec) {
        var that = {},
            member,
            method = function() {
                // spec, member, method
            };
        that.method = method;
        return that;
    }

    function derived(spec) {
        var that = base(spec),
            member,
            method = function() {
                // spec, member, method
            };
        that.method = method;
        return that;
    }
I'd suggest you watch the talk linked above for this stuff in context.
Re:Google SoundScript: faster OOP for JavaScript by Touche on Wednesday February 04, 2015 @04:56PM (#9000236)
That is not inheritance. `instanceof` doesn't work. There would be no way to know that an object from derive dis of the type of base.

That's also very memory inefficient. The method function gets made for every instance. With prototypes there would be only 1 function in memory. This stuff matters at scale.

Re:Google SoundScript: faster OOP for JavaScript by greggman on Thursday February 05, 2015 @04:12AM (#9002334)
Watch the talk.

You've got a gig of ram in your pocket. Memory doesn't matter for 99.99999% of apps. The memory taken by your objects isn't where your memory goes. It goes to images and other big stuff. A few extra bytes per object isn't going to kill you. Optimize for programmer time not memory, especially not in memory on things that don't matter.

Why are you using "instanceof". The whole point of inheritance is you shouldn't have to ask. If you are asking your doing it wrong

Re:Google SoundScript: faster OOP for JavaScript by aikah on Wednesday February 04, 2015 @07:52PM (#9001109)
and then how do you implement super with your system? because that's the point of prototypes,the fact that you're not overloading methods but you have access to the prototype chain.much harder to do with your method.
Re:Google SoundScript: faster OOP for JavaScript by greggman on Thursday February 05, 2015 @04:13AM (#9002336)
You shouldn't need access to the prototype chain. Accessing that chain is an anti-pattern.
Re:Google SoundScript: faster OOP for JavaScript by aikah on Thursday February 05, 2015 @05:33AM (#9002558)
no it isn't,that's how you implement "super" in javascript.
Re:Google SoundScript: faster OOP for JavaScript by Yahivin on Wednesday February 04, 2015 @04:24PM (#8999933)
Check out Daniel X. Moore's `{SUPER: SYSTEM}`. http://stackoverflow.com/a/3731253