Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Have you looked at the implementations of classes in jQuery, Prototype, Mootools, Dojo, etc? I have. I've used thousands of lines of codes from these libraries and fixed numerous bugs in them. ( Note I'm referring to the 'bind' function specifically in the case of jQuery as it doesn't even provide an equivalent to Class.create(). That said, John Resig himself wrote an article about this and ported out the core of Prototype [ same as I have done ] http://ejohn.org/blog/simple-javascript-inheritance/ )

Using the prototype may be the way that things get copied from the base definition to an instance, but generally closures are what allow things to have the proper scope. Arguably the scope is far more important for using something like a class than the copying. Additionally, without closures there is no way to pass of anonymous function pointers calling back into the class.

If you think you are demonstrating that I have a lack of knowledge of how this shit works, you are mistaken. But by all means, continue disregarding my points and nitpicking details instead.

You will note that here on hacker news I don't really give a shit about my credibility; I care about providing the most accurate information I can to the benefit of others.

You haven't invalidated my statement about translators at all. ES5, ES6, etc are not cross-browser compatible. Using a translator to "make it work" doesn't count. If you wish to say that C++ is cross browser compatible too then fine, but it is obscuring the root issue that those features do not exist in all the browsers, nor even the whole set of them in any one browser. This is misinformation and will mislead developers.

My last paragraph is in reference to the fact that JS/Ecmascript have never truly been "fixed". It is just a constant hodgepodge of whatever vendors decides to add on to the language.



> Have you looked at the implementations of classes in jQuery, Prototype, Mootools, Dojo, etc?

Yes, and jQuery doesn't implement classes.

> I care about providing the most accurate information I can to the benefit of others.

By calling other people fanboys after they provided a link?

> ES5, ES6, etc are not cross-browser compatible.

I guess it depends on your definition of cross-browser compatible, but ES5 is what, 5 years old now? I guess it doesn't work on IE8, but by that definition ES3 isn't cross-browser compatible because it doesn't work on IE1.

As for ES6, it's cross-browser compatible in the same way that CoffeeScript is, with the added benefit that it'll work natively in most browsers in a few years.

> My last paragraph is in reference to the fact that JS/Ecmascript have never truly been "fixed". It is just a constant hodgepodge of whatever vendors decides to add on to the language.

That's really not the case anymore.


jQuery provides bind. That and related code is what I am referring to in that case, hence my insistence on the importance of closures. I have revised my comment to mention this as well as the fact the John Resig himself reccomends the Prototype way of doing Class.create(). By the way, Class.create() itself is implemented as a closure.

Are you claiming that CoffeeScript is cross browser compatible? If so you are just going further down the rabbit hole. To my knowledge there is not a single browser than itself is capable of parsing CoffeeScript without a helper library that doesn't come installed by default. ( Firebug comes to mind, and if I recall correctly there is a helper tool for that. I'm also aware of source mapping for debugging things such as JS in both Firebug and Chrome )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: