Is class syntax really necessary ?

Bob Nystrom rnystrom at google.com
Mon May 23 11:32:57 PDT 2011


>
> Using "public" to refer to an instance property seems totally weird to me.
>

For what it's worth, I agree. I'd prefer var or instance. I've already seen
at least one example of someone misinterpreting it and doing something like:

class C {
  public someMethod() { ... }
}

Their intent was to define a method on C's prototype (like you usually do)
and have it be publicly accessible (like they usually are), but the above
syntax doesn't do that. It's, I believe, an error instead because you're
trying to define a *per-instance* method and it doesn't allow per-instance
initializers.

I'm pretty sure most people reading the above code would not interpret it
the way the proposal does.

- bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110523/7307a067/attachment.html>


More information about the es-discuss mailing list