On Fri, Sep 30, 2011 at 12:59 PM, Axel Rauschmayer <[email protected]> wrote:
> I wholeheartedly agree with not obsessing about the token count. I’m very
> sensitive to context in this regard: in some contexts, I don’t mind or even
> welcome additional tokens, in other contexts I hate them.
>
> However, avoiding repeating the same identifier several times seems worth
> it to me (this kind of redundancy goes beyond dropping a token or using
> shorter tokens).
>
+1 to this. I don't think a shorthand for this is the most important part of
a class syntax, but it seems like a relatively easy win for a part of the
language that currently feels unnecessarily redundant.
- bob
>
> Java:
> class Point {
> public int x;
> public int y;
> public Point(int x, int y) {
> this.x = x;
> this.y = y;
> }
> }
>
> JavaScript:
> class Point {
> constructor(this.x, this.y) {
> }
> }
>
> Java is even more fun if you have getters and setters for x and y.
>
> --
> Dr. Axel Rauschmayer
>
> [email protected]
> twitter.com/rauschma
>
> home: rauschma.de
> blog: 2ality.com
>
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss