Hacker News new | past | comments | ask | show | jobs | submit | jsnoble's comments login

Before ES6 im curious did you always need blocked scoped variables? Of course we used iife's when we needed to but how often did we need to do that compared to the times we used regular variables. Is it always worth the extra overhead to enforce everything being blocked scoped? What about times that we needed to alter something outside the scope? whether or not thats always a good idea is another discussion but there are valid uses. I remember people were getting all worked up over functional expressions vs declarations saying expressions were 'the one true way' since it more closely resemebles how the compiler reads it. As babel shows let and const are just var's with extra overhead. Dont get me wrong let and const are in the right direction but they are not 'the one true way'


Actually it might be easier to screw up. People will think these are real traditional "OO" classes but they are not. Its all prototypal, and you will be in a world of hurt creating bug and performance hits if you treat them as if they are the same. Also, functions inside a ES6 class are hijacked. You cannot bind those functions to work on another context which is a core javascript technique, it will break. Thus in the end, any person familiar with javascript will have to learn even more caveats which will create more confusion. You wouldnt want to use ES6 classes on anything super complex.


The class in ES6 is just syntactic sugar over Object.create. Class is only coming out becuase most people wont learn that javascript has prototypal inheritance, and how to use it. Its a different mental model, in my opinion prototypal inheritance is more expressive and light weight than typical classes from other languages


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

Search: