>
> As Allen mentioned, I think it would really help if you could show, say,
> real Java (or C# or C++) code and explain what it can do that JavaScript +
> private names can’t.
>

(Sorry for that double-post, BTW)

I can't : )

It's an abstract guarantee.  Private methods (in Java let's say) give me
the guarantee that I can refactor at will with them without any externally
visible changes.  Privately named methods in JS do not.

Look at it this way:  if I have a method that looks like this:

    private helperMethod() { ... }

and it's called from another method like this:

    toString() { this.@helperMethod(); }

someone coming from Java or C# is going to expect a nonvirtual method
invokation.  See the Java spec for details [1].  OK - everything is dynamic
in JS, so they're just "confused", right?  Why even invite that confusion
with misleading syntax?

"private" syntax isn't a part of the current class proposal, I know.  I'm
just trying to think ahead - and to strike at the heart of what a "class"
in JS ought to be.


kevin

[1]:  http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to