I would like to add my suggestion for js classes.

https://gist.github.com/1224324


The key points are:


   - Constructors are functions named the same as the class.
   - Inside the class, *this* refers to the class instance.
   - Functions and variables are declared outside the constructor, inside
   the class block.
   - function and var keywords are optional after  private  or  public
    keywords.
   - Getters, Setters are optional, but often useful. My example could be
   very concise after removing comments, spacing and getters/setters.
   - When compiled & minified, this syntax would be nearly equivalent to the
   current proposal (size-wise).


Arguments & Warrant:


This form would be very recognizable to people familiar with classical
object oriented languages, yet it still maintains javascript's dynamic
nature and prototypal inheritance. Almost everything in this form of class
could be compiled to a prototypal form.


I also argue that this form of class is far more readable, which is a very
important trait as javascript applications become ever larger and more
complicated
as the web evolves.


Lastly, I definitely have to veto the private @ syntax as posted in
Brendan's TXJS slides. Apparently M. Night is also on the ECMA committee,
because having symbols act as both operators and special, prefixed accessors
would be quite a twist. :)


Jonathan Dumaine
+1 50.55.10.11.12
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to