5 ms·
Yeah, they're syntactic sugar.
by TazeTSchnitzel 14y ago
Yeah, they're syntactic sugar.
- Offler 14y agoI'd bet you they will allow browsers to optimize their compilation steps, so they are more then just sugar.
- TazeTSchnitzel 14y agoNo, they're just sugar. It has no relation to whether you can use them to optimise things or not.
- Offler 14y agoIt's called Type Specialization http://dl.acm.org/citation.cfm?id=1542528 http://dl.acm.org/citation.cfm?id=1542528
- asynchrony 14y agoClass declarations will be equivalent (can be desugared to) a function declaration and some manipulations of the function's prototype. JS VMs already optimize this pattern, so why should syntax sugar for classes be anything special for the compiler?
- Offler 14y agoBecause it takes time and CPU cycles for them to figure out what is a Type and what is not. They don't know how much memory to allocate to these objects for instance, but now with classes they will know types immediately.