Is class syntax really necessary ?

Mark S. Miller erights at google.com
Mon May 23 11:52:16 PDT 2011


On Mon, May 23, 2011 at 11:32 AM, Bob Nystrom <rnystrom at google.com> wrote:

> 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.
>

Just to be clear, the current proposal reject this as an early syntax error.
It is only if we extend the public declarations to allow out-of-constructor
initializations that we would get into this specific trouble.




>
> - bob
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110523/4a7bae0d/attachment.html>


More information about the es-discuss mailing list