Sep 27 meeting notes

Erik Arvidsson erik.arvidsson at
Fri Sep 30 10:57:08 PDT 2011

On Fri, Sep 30, 2011 at 10:12, Bob Nystrom <rnystrom at> wrote:
>   // Constant on class.
>   const ZERO = new Point(0, 0);

I don't like this. It is too magic and I don't expect people to
remember to use class.ZERO or MyClass.ZERO over this.ZERO.

>   // Function on class.
>   class add(a, b) {
>     return a.add(b);
>   }
>   // Nested class (data property on class whose value is a class).
>   class Foo {
>     ...
>   }

These two look too similar for my liking. I know people don't like
'static' but it is a lot clearer what the intent is.

In general I don't like having some things go on the prototype and
some on the function/class. I see refactoring hazards (changes from
const to var/let will break)

One of the things I like about the object literal syntax is that it
doesn't seem like things might be in scope. Take this example (with
intentional error):

class Point {
  var x = 0;
  var y = 0;
  distance(other) {
    return Math.sqrt(x * other.x + y * other.y);

it is very tempting to think that var x and var y are in scope. If an
object literal is used at least we have the current behavior to steer
people into doing the right thing.


More information about the es-discuss mailing list