Skip to content

Editorial: Convert @@ notation to intrinsics notation for well-known Symbols#1314

Merged
ljharb merged 2 commits intotc39:mainfrom
ljharb:luke_skywalker
Jul 1, 2024
Merged

Editorial: Convert @@ notation to intrinsics notation for well-known Symbols#1314
ljharb merged 2 commits intotc39:mainfrom
ljharb:luke_skywalker

Conversation

@ljharb
Copy link
Copy Markdown
Member

@ljharb ljharb commented Sep 27, 2018

  • this avoids a conceptual conflict with decorators, when they land

Open to bikesheds; other alternatives I considered:

  • explicitly using intrinsics, ie, %SymbolSpecies%, and hardcoding that table, while removing the "well-known symbols table". This felt like it would lose some clarity around intrinsics vs well-known-symbols.
  • Using %Symbol%species% - this would require upstream support in ecmarkup, so i opted not to do it for now.
  • something else?

@gibson042
Copy link
Copy Markdown
Member

Will this interact with special treatment of %% by ecmarkup (e.g., for "%%Internal%%" in specHTML)? And as a meta question, do we want to introduce auto-linking of well-known symbols if we're changing their representation?

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Sep 27, 2018

@gibson042 i would love to see auto-linking of well-known symbols, with or without this change.

I've tested the HTML output locally and atm they don't link anywhere, before or after.

@annevk
Copy link
Copy Markdown
Member

annevk commented Sep 27, 2018

This would also affect the HTML Standard.

cc @domenic

@ljharb ljharb requested a review from domenic September 27, 2018 17:21
@domenic
Copy link
Copy Markdown
Member

domenic commented Sep 27, 2018

Happy with whatever. It would be nice cross-SDO citizenship work to make a corresponding HTML Standard PR, but it's certainly not required.

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Sep 27, 2018

@domenic i'm happy to try my hand at that once an approach gets consensus here, prior to merging this one.

@littledan
Copy link
Copy Markdown
Member

Would it be possible to use a syntax more similar to Symbol.foo, so that it looks more similar to how JavaScript developers refer to the same thing?

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Sep 30, 2018

What’d you have in mind? It would have to be apparent that it’s not a property lookup on %Symbol%, i suspect.

@littledan
Copy link
Copy Markdown
Member

Sorry, I don't have a concrete suggestion, and agree it shouldn't imply actual property access. But I would prefer that editorial churn like this would somehow inch us closer to being readable by normal programmers. @@ is now understood by a small set of people outside TC39; using a new syntax will make it harder to understand for that see while keeping it unintuitive for the big majority.

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Oct 1, 2018

My preference would be to use the %SymbolSpecies% notation and move the well-known symbols table to immediately following the intrinsics table. That way we reduce the total number of novel syntaxes in the spec. I don't actually think there is much of an important distinction between intrinsics and well-known symbols except for the cross-realm interaction. They're similar enough that it makes sense to put them near each other and use the same syntax, IMO.

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Oct 3, 2018

@bakkot i initially looked at doing that, but it seemed like a loss to remove the useful info in this section.

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Nov 22, 2018

See also #385.

@bakkot
Copy link
Copy Markdown
Member

bakkot commented Nov 22, 2018

figure-2.png also needs to be updated, since it contains the text @@hasInstance.

@ljharb ljharb self-assigned this Nov 23, 2018
@zenparsing
Copy link
Copy Markdown
Member

I'm thinking that we should leave things the way they are for now, since @@ is well-understood, fairly readable, and used by other specs.

ljharb added a commit to ljharb/ecma262 that referenced this pull request Aug 7, 2019
…c39#1314)

 - this avoids a conceptual conflict with decorators, when they land
ljharb added a commit to ljharb/ecma262 that referenced this pull request Oct 4, 2019
…c39#1314)

 - this avoids a conceptual conflict with decorators, when they land
@bakkot bakkot added the editor call to be discussed in the next editor call label Nov 6, 2019
@michaelficarra
Copy link
Copy Markdown
Member

Decision from the editor call today was to change @@symbolName notation to %Symbol.symbolName% for consistency with other instrinsics.

@michaelficarra michaelficarra removed the editor call to be discussed in the next editor call label Nov 20, 2019
@ljharb ljharb removed the request for review from bterlson November 20, 2019 23:58
@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Jun 27, 2024

True enough, but that's often unavoidable, and in this case, it'll be far more confusing if we have a spec with both decorators and @@ in it.

@Josh-Cena
Copy link
Copy Markdown
Contributor

Decorators don't use @@ though, and code entities are typeset differently in the spec, if they are used at all. I see it can be confusing for MDN (which is another thing to think about, for us!), but not for the spec.

jmdyck
jmdyck previously requested changes Jun 27, 2024
Comment thread spec.html Outdated
Comment thread spec.html Outdated
Comment thread spec.html Outdated
ljharb added a commit to ljharb/ecma262 that referenced this pull request Jun 28, 2024
…c39#1314)

 - this avoids a conceptual conflict with decorators, when they land
Copy link
Copy Markdown
Collaborator

@jmdyck jmdyck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You gave a new clause id to every intrinsic with the property key %Symbol.foo%, except for:

  • RegExp.prototype [ %Symbol.matchAll% ]
  • %AsyncIteratorPrototype% [ %Symbol.asyncIterator% ]
  • AsyncFunction.prototype [ %Symbol.toStringTag% ]

Did you intend to skip those?

Apart from that, looks okay to me.

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Jun 28, 2024

I didn't do it intentionally, it's just that I only changed the ones that had @@ in them.

I could change them to be consistent, but I'm not sure if that's worth the churn + oldids.

@jmdyck
Copy link
Copy Markdown
Collaborator

jmdyck commented Jun 29, 2024

I didn't do it intentionally, it's just that I only changed the ones that had @@ in them.

That was my guess at first, but then I noticed that you had introduced new ids to replace

  • sec-asyncgeneratorfunction-prototype-tostringtag
  • sec-asyncgenerator-prototype-tostringtag

which don't have @@.

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Jun 29, 2024

Guess I was just being inconsistent in my application then :-) I'll update them to match.

Copy link
Copy Markdown
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM.

Comment thread spec.html Outdated
@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Jul 1, 2024

…c39#1314)

 - this avoids a conceptual conflict with decorators, when they land
@Josh-Cena
Copy link
Copy Markdown
Contributor

@ljharb Out of curiosity: what's up with "luke_skywalker"?

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Jul 1, 2024

@Josh-Cena this PR kills at-at's

@Josh-Cena
Copy link
Copy Markdown
Contributor

Oh! lmao 😄

@domenic
Copy link
Copy Markdown
Member

domenic commented Jul 2, 2024

Just want to drop in with an extra thanks to @ljharb for doing the HTML and Web IDL PRs. That kind of cross-ecosystem citizenship is much appreciated.

@linusg
Copy link
Copy Markdown
Member

linusg commented Jul 3, 2024

PR for ECMA-402: tc39/ecma402#905

@ljharb
Copy link
Copy Markdown
Member Author

ljharb commented Jul 3, 2024

whoops, i should have made that one too. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editorial change ready to merge Editors believe this PR needs no further reviews, and is ready to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.