Le 29/10/2011 05:23, Axel Rauschmayer a écrit : > http://brendaneich.com/2011/10/jsconf-eu/ Brendan Eich in the article: > Much of the Dart <http://dartlang.org/> class syntax design looks good > to me. Possibly TC39 can agree to adopt it, with necessary > adjustments. It would still be sugar for constructors and prototypes. (It can be found at [1]) What are the parts of the design that look good to you? What are the adjustments you can think of now?
My take on it is that: - Differenciating public/private with an underscore (_) seems like a bad idea since if people try to automatically transition JS code to Dart, some variable will have ambiguities and it may lead to bugs that are hard to find. Also, semanticly signifiant identifiers prefix doesn't exist yet in JS. - On private fields, I really wonder how these are currently translated into JS, because private fields on objects can't exist if methods are on the prototype. Unless there are weakmaps (with leaks in environment with no weakmap). Or maybe methods are not on the prototype (which would differ from the semantics ES wants to give to class methods and have a memory cost as well) - "var" for attribute declaration seems to be at the opposite of the intent of "let is the new var" for ES.next - Imposing to name a constructor (or several) and not being able to pass arguments to the class name when used with "new" sounds weird (that's what I understand based on the examples). Besides these parts, we're left with a "class" keyword and a declarative syntax, some sugar for getter/setter which I agree with but is already in the classes strawman. David [1] http://www.dartlang.org/docs/getting-started/class.html
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

