News for hackers. Stuff that matters.
Re:JavaScript right on the hardware by dkuntz2 on Wednesday August 14, 2013 @07:19PM (#6215109)
I personally don't like that everything's a hash. It's nifty, and it means you don't really need objects, but I kinda like objects, even if I don't use them frequently in Python.

Your preference makes sense, it's just not the same one I have. More on topic for this thread, I'm still not convinced that it's a good thing for an embedded system.

Re:JavaScript right on the hardware by Tichy on Wednesday August 14, 2013 @07:27PM (#6215147)
You can use objects in JS if you want to - but fair enough, different tastes and preferences.
Re:JavaScript right on the hardware by dkuntz2 on Wednesday August 14, 2013 @07:35PM (#6215194)
I didn't say you couldn't, I just skimmed over them. The prototype stuff is funky to me, I'd rather just have a straightforward syntax with objects.
Re:JavaScript right on the hardware by DonPellegrino on Wednesday August 14, 2013 @10:33PM (#6215852)
It takes less than an hour to learn and get used to it if you know the standard Java-style OOP already. It's worth it and it'll give you a whole new opinion on what OOP means.

I made this a while ago, see if you can figure out how it works: http://jsfiddle.net/AXTdj/

Re:JavaScript right on the hardware by dkuntz2 on Wednesday August 14, 2013 @11:28PM (#6215996)
I know how it works, I just find it worse, by far. There's a whole lot more overhead to getting it working, specifically all of the foo.prototype stuff, and it doesn't require that everything be together.

Sure, it's kinda nice that you're able to extends objects later on, but I'd rather have everything neatly declared in one place.

It definitely does not "give me a whole new opinion on what OOP means", it furthers my opinion that I'm not a fan of JavaScript.

Re:JavaScript right on the hardware by PommeDeTerre on Thursday August 15, 2013 @08:00AM (#6217267)
It's very good to see more and more people openly admitting that JavaScript's prototype-based OO approach just isn't practical.

For far too long now we've had to hear JavaScript advocates go on and on about how good JavaScript's approach is. Yet over and over we see developers being forced to fake a limited subset of class-based OO one way or another, just to get their work done effectively.

Of course, there are multiple ways of faking class-based OO in JavaScript, with varying degrees of compatibility with one another. In any sizable JavaScript code base, especially if third-party libraries are used, these incompatibilities can become a very real issue, very quickly.

This is one of the things that the JavaScript community should have addressed years ago.

Re:JavaScript right on the hardware by nilliams on Thursday August 15, 2013 @09:45AM (#6217686)
>> In any sizable JavaScript code base, especially if third-party libraries are used, these incompatibilities can become a very real issue, very quickly.

Whether you use constructor functions, object literals, or the module pattern to structure your code in an OO-like manner, they all result in 'functions hung off objects' which can be called in the same way: object.foo(), I don't see the very real compatibility issue you're talking about.

>> It's very good to see more and more people openly admitting that JavaScript's prototype-based OO approach just isn't practical.

It's plenty practical, I will welcome ES6's class keyword for the clearer semantics, but this is simply vague FUD.

Re:JavaScript right on the hardware by esailija on Thursday August 15, 2013 @08:57AM (#6217468)
Your entire complaint is very superficial and easy to fix with any convention you like. For example: http://jsfiddle.net/AXTdj/3/ I included "overhead" calculations.
Re:JavaScript right on the hardware by Tichy on Thursday August 15, 2013 @04:06AM (#6216655)
You know that you can just do

foo.prototype = { dothis: function(){}, dothat: function(){}

}

In the beginning I wrote it more like

foo.prototype.dothat = function(){} foo.prototype.dothis = function(){}

Which was a lot more ugly.