Russell Leggett wrote:


On Fri, Mar 23, 2012 at 7:00 AM, Herby Vojčík <he...@mailbox.sk
<mailto:he...@mailbox.sk>> wrote:
    I will repeat myself, I proposed this thing but no one reacted. It's
    short, does not clash as new mentioned before, and does not preclude
    constuctor magic in any way:

    class Class extends SuperClass {
      @(params) { body } // constructor
      @x(params) { body } // private-named method
      y(params) { body } // plain method
    }

    Of course, this syntax is based on '@xxx' private name access
    pattern is also in the language - constructor is intentionally
    reusing this syntax, but with 'empty identifier' - as a special
    short construct to use for constructor. Reusing private name syntax
    is safe as to name clash, because it does not clash with property
    names (and using empty identifier, neither does clash with real
    private names).

I'm not sure if you're suggesting we add private name support for this
proposal, but that would be feature creep. If you are suggesting only

No. I am just aware of possibility that foo.@bar may end up as syntax for foo[bar] if bar is private name, freeing [] for overloading with "collection element access" as in object reformation proposal.

In this proposal, I am silently assuming it is so (the @x is from there).

@() for constructor, then I think that would still be pretty confusing
and grawlixy. I suppose you could make the argument that the underlying
constructor itself is some private property, and therefore makes sense

Exactly. With *some* made emphasized.

to use @, but that seems like exposing internals on something that
should be straightforward. If that was not your intention, then I think

Or, more "special" then "private".

it's even more confusing because you're associating the constructor with
something private.

As I noted above, constructor is something 'special' or 'magical' anyway. It _is_ true that if string name should be use, constructor is most appropriate because, well, it is there already.

If other name should be used, it creates confusion that it is treated specially, so the mathod of that name is not present, and on the contrary, it is present there under the name 'constructor' (!!!).

So if people want something new, possibly not a reserved name because of previous paragraph, the idea is to reuse private syntax but with 'null identifier'.

It is special (which constructor is), and short. Yes, grawlixy, but not conpletely nonsensical, because @xxx is (in this parallel universe where foo.@bar is accepted) used for naming other special things (private properties) anyway.

- Russ
    Herby
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to