Property names for public symbols

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Property names for public symbols

Axel Rauschmayer
I know that this is a small nit and that it’s probably too late, but: Shouldn’t public symbols (`Symbol.iterator` etc.) have all-uppercase property names? It would indicate that they are constants and it would visually set them apart from other stuff that is in `Symbol` (`Symbol.for()` etc.).

-- 
Dr. Axel Rauschmayer
[hidden email]
rauschma.de




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Mark Volkmann
Agreed, like at the constants on the Math object.

---
R. Mark Volkmann
Object Computing, Inc.

On Feb 6, 2015, at 12:39 AM, Axel Rauschmayer <[hidden email]> wrote:

I know that this is a small nit and that it’s probably too late, but: Shouldn’t public symbols (`Symbol.iterator` etc.) have all-uppercase property names? It would indicate that they are constants and it would visually set them apart from other stuff that is in `Symbol` (`Symbol.for()` etc.).

-- 
Dr. Axel Rauschmayer
[hidden email]
rauschma.de



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Gary Guo
In reply to this post by Axel Rauschmayer

Probably too late, since ther is already implementations starting implementing them, what's more, I think constant are not necessarily uppercase - we should not apply convention of C on ECMAScript. To me it is reasonable to use lowercase.


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Brendan Eich-2
In reply to this post by Mark Volkmann
Some tasteful inconsistency (the hobgoblin of big minds) is required
here. We want the well known symbols' names as static properties of
Symbol to be same-named.

/be

Mark Volkmann wrote:

> Agreed, like at the constants on the Math object.
>
> ---
> R. Mark Volkmann
> Object Computing, Inc.
>
> On Feb 6, 2015, at 12:39 AM, Axel Rauschmayer <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>> I know that this is a small nit and that it’s probably too late, but:
>> Shouldn’t public symbols (`Symbol.iterator` etc.) have all-uppercase
>> property names? It would indicate that they are constants and it
>> would visually set them apart from other stuff that is in `Symbol`
>> (`Symbol.for()` etc.).
>>
>> --
>> Dr. Axel Rauschmayer
>> [hidden email] <mailto:[hidden email]>
>> rauschma.de <http://rauschma.de>
>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> [hidden email] <mailto:[hidden email]>
>> https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Axel Rauschmayer
Can you explain what you mean by “same-named”? You want `Symbol.for()` to have the same casing as `Symbol.iterator`?


On 07 Feb 2015, at 02:17, Brendan Eich <[hidden email]> wrote:

Some tasteful inconsistency (the hobgoblin of big minds) is required here. We want the well known symbols' names as static properties of Symbol to be same-named.

/be

Mark Volkmann wrote:
Agreed, like at the constants on the Math object.

---
R. Mark Volkmann
Object Computing, Inc.

On Feb 6, 2015, at 12:39 AM, Axel Rauschmayer <[hidden email] <[hidden email]>> wrote:

I know that this is a small nit and that it’s probably too late, but: Shouldn’t public symbols (`Symbol.iterator` etc.) have all-uppercase property names? It would indicate that they are constants and it would visually set them apart from other stuff that is in `Symbol` (`Symbol.for()` etc.).

-- 
Dr. Axel Rauschmayer
[hidden email]
rauschma.de




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Brendan Eich-2
Axel Rauschmayer wrote:
> Can you explain what you mean by “same-named”? You want `Symbol.for()`
> to have the same casing as `Symbol.iterator`?

No, I mean we would normally use iterator (and had __iterator__ in
SpiderMonkey, then '@@iterator' I believe), not ITERATOR. Python's
dunder-bracketing doesn't cut it, symbols win. But UPPERCASE loses.

/be
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Axel Rauschmayer
Got it: public symbols stand for property names and those are typically camel-case, starting with a lowercase letter.

On 08 Feb 2015, at 02:09, Brendan Eich <[hidden email]> wrote:

Axel Rauschmayer wrote:
Can you explain what you mean by “same-named”? You want `Symbol.for()` to have the same casing as `Symbol.iterator`?

No, I mean we would normally use iterator (and had __iterator__ in SpiderMonkey, then '@@iterator' I believe), not ITERATOR. Python's dunder-bracketing doesn't cut it, symbols win. But UPPERCASE loses.

/be

-- 
Dr. Axel Rauschmayer
[hidden email]
rauschma.de




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Mark Volkmann
I'm curious why one of the public symbols has a name that ends with "Tag" ("toStringTag"), but the others don't (such as "toPrimitive"). Maybe "toStringTag" should be changed to "toString".

 __  __
/  \/  \
\      /ark
               Object Computing, Inc.
  \  /
   \/olkmann

On Sun, Feb 8, 2015 at 4:20 AM, Axel Rauschmayer <[hidden email]> wrote:
Got it: public symbols stand for property names and those are typically camel-case, starting with a lowercase letter.

On 08 Feb 2015, at 02:09, Brendan Eich <[hidden email]> wrote:

Axel Rauschmayer wrote:
Can you explain what you mean by “same-named”? You want `Symbol.for()` to have the same casing as `Symbol.iterator`?

No, I mean we would normally use iterator (and had __iterator__ in SpiderMonkey, then '@@iterator' I believe), not ITERATOR. Python's dunder-bracketing doesn't cut it, symbols win. But UPPERCASE loses.

/be

-- 
Dr. Axel Rauschmayer
[hidden email]
rauschma.de




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Axel Rauschmayer
This symbol is about the string tag.

On 08 Feb 2015, at 14:05, Mark Volkmann <[hidden email]> wrote:

I'm curious why one of the public symbols has a name that ends with "Tag" ("toStringTag"), but the others don't (such as "toPrimitive"). Maybe "toStringTag" should be changed to "toString".

 __  __
/  \/  \
\      /ark
               Object Computing, Inc.
  \  /
   \/olkmann

-- 
Dr. Axel Rauschmayer
[hidden email]
rauschma.de




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Brendan Eich-2
In reply to this post by Mark Volkmann
Mark Volkmann wrote:
> I'm curious why one of the public symbols has a name that ends with
> "Tag" ("toStringTag"), but the others don't (such as "toPrimitive").
> Maybe "toStringTag" should be changed to "toString".

That would be the wrong name -- the Tag is specific, particular to the
purpose of this symbol. It's not an under-used generic suffix for all
well-known symbol names. See
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring.

/be
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Property names for public symbols

Gary Guo
How about "classTag" instead of "toStringTag", which makes it sound like a noun.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Jordan Harband
"[[Class]]" was the pre-ES6 term to refer to this value, but with the ES6 "class" keyword that would be confusing, and I don't think it would be a good idea to conflate the meaning of the term even further.  "toString" is a common single idiom in JS since it's the function that String() invokes, so "toStringTag" works for me.

This particular value is one that, imo, in practice should be rarely used (once per "class" perhaps, in its definition), so I'm not hugely concerned about the naming (my concerns were about the behavior). My guess would be that in order to effect a change at this very late date, one would have to propose a name that was so compelling as to make it an obvious choice.

On Mon, Feb 9, 2015 at 7:16 AM, Gary Guo <[hidden email]> wrote:
How about "classTag" instead of "toStringTag", which makes it sound like a noun.

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Property names for public symbols

Gary Guo
Actually I disagree with you. `Class` will not be confusing, since as you said, people probably will use `toStringTag` once per `class`. So `classTag` just becomes a better name. String, Boolean, etc, are just names of classes.


From: [hidden email]
Date: Mon, 9 Feb 2015 09:55:01 -0800
Subject: Re: Property names for public symbols
To: [hidden email]
CC: [hidden email]; [hidden email]

"[[Class]]" was the pre-ES6 term to refer to this value, but with the ES6 "class" keyword that would be confusing, and I don't think it would be a good idea to conflate the meaning of the term even further.  "toString" is a common single idiom in JS since it's the function that String() invokes, so "toStringTag" works for me.

This particular value is one that, imo, in practice should be rarely used (once per "class" perhaps, in its definition), so I'm not hugely concerned about the naming (my concerns were about the behavior). My guess would be that in order to effect a change at this very late date, one would have to propose a name that was so compelling as to make it an obvious choice.

On Mon, Feb 9, 2015 at 7:16 AM, Gary Guo <[hidden email]> wrote:
How about "classTag" instead of "toStringTag", which makes it sound like a noun.



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Property names for public symbols

Jordan Harband
Based on my understanding of the spec, I'd say that String, Boolean, etc are not "classes" at all, since they don't have a [[HomeObject]] - they're just constructor functions.

On Thu, Feb 12, 2015 at 7:55 PM, Gary Guo <[hidden email]> wrote:
Actually I disagree with you. `Class` will not be confusing, since as you said, people probably will use `toStringTag` once per `class`. So `classTag` just becomes a better name. String, Boolean, etc, are just names of classes.


From: [hidden email]
Date: Mon, 9 Feb 2015 09:55:01 -0800
Subject: Re: Property names for public symbols
To: [hidden email]
CC: [hidden email]; [hidden email]


"[[Class]]" was the pre-ES6 term to refer to this value, but with the ES6 "class" keyword that would be confusing, and I don't think it would be a good idea to conflate the meaning of the term even further.  "toString" is a common single idiom in JS since it's the function that String() invokes, so "toStringTag" works for me.

This particular value is one that, imo, in practice should be rarely used (once per "class" perhaps, in its definition), so I'm not hugely concerned about the naming (my concerns were about the behavior). My guess would be that in order to effect a change at this very late date, one would have to propose a name that was so compelling as to make it an obvious choice.

On Mon, Feb 9, 2015 at 7:16 AM, Gary Guo <[hidden email]> wrote:
How about "classTag" instead of "toStringTag", which makes it sound like a noun.




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss