Open littledan opened 6 years ago
So afaik it's:
object.\[\[Foo]]
(ES-spec notation).Get(object, "foo")
(ES-spec notation).dictionary["foo"]
(Infra notation).Property and dictionary access seem reasonably well-defined by ES and Web IDL.
Internal slots are tricky since many web specs have effectively borrowed the notion from ES without a formal definition that applies beyond the ES realmecosystem. (E.g. it's technically not defined that internal slots can exist on Web IDL objects, as opposed to the JS objects they correspond to.) I'm not sure whether that's an Infra-level thing or a Web IDL-level thing. There's a Web IDL issue at https://github.com/heycam/webidl/issues/258 with some previous discussion.
Another thing worth noting, although again hard to say whether something so ecosystem-specific belongs in Infra, is that in most web specs, it'll be supremely rare to use ES Get() notation, because everything will have been converted to e.g. a dictionary, instead of needing raw property access.
Maybe Infra isn't the right doc for it, but it'd be nice if somewhere, there were a "web spec notation beginner's guide", or at least a designated, "look at this particular spec--it's in the most modern form". I'm not sure how someone is supposed to start out when there are so many documents.
You may be interested in https://docs.google.com/document/d/1cRVD1k-hDBGfLVwTG14P_ZqJLM4d5-Z4vpwYFb_4qks/edit?usp=sharing , which is a rough draft collection of resources I once wrote up for someone else.
I think for the web platform that is correct as it's a bit more readable without the square brackets.
There are of course places such as Web IDL and certain algorithms in HTML that need internal slots for parity with JS.
Oh, I wasn't aware the consensus had shifted. I've used slots in a lot of my specs to refer to the internal value of an attribute.
However we do it, tho, we should formalize in IDL and/or Infra.
Yes. I regret introducing the unnecessarily-complex internal slot notation, along with its implications from ES, into the ecosystem. My bad; I was young and thought that the ES spec was the best spec ever.
I'm not sure if this is all out of the scope of the infra spec, but it's a point of confusion for me as a new web spec author: I'm never quite sure what the right notation is for three things:
object's \[\[Foo]] internal slot
vsobject.\[\[Foo]]
)? Get(object, "property")
vsobject.property
vs something in between)dictionary.member
vs I'm not sure)If this guide, or some other specification (WebIDL?) could clarify, that would be helpful. It's hard for me to figure this out from current specs, as I've been corrected on style issues even when taking style directly from other recent specs.
cc @tobie