Ecma262: Editorial convention for referring to intrinsics

Created on 31 May 2020  路  10Comments  路  Source: tc39/ecma262

Some intrinsics have multiple names: for example, %AsyncGenerator% and %AsyncGeneratorFunction.prototype% name the same object. We should decide which we prefer, document that, and be consistent about which we use.

(This came up in https://github.com/tc39/ecma262/pull/1781, e.g. https://github.com/tc39/ecma262/commit/51072eb44a27de37e7759f74cb5c2ab53865f306.)

Most helpful comment

can we rename them to %(Async)GeneratorFunction.prototype% please, it is very confusing to differentiate "Generator" and "GeneratorFunction"

All 10 comments

The decision has already been that the dotted form should always be used, except in the Well-Known Intrinsics table, and also in the places where the non-dotted intrinsics are defined.

If there are any cases that deviate from this, let's please fix them.

Additionally, as soon as we can verify that HTML is no longer using an undotted form, it can and should be removed entirely from 262.

If there are any cases that deviate from this, let's please fix them.

There's a number of uses of %Generator% and %AsyncGenerator%, at least.

it can and should be removed entirely from 262.

I think it would be worth preserving these at least in a NOTE, for documentation purposes.

Generator and AsyncGenerator are top-level types, so I'd expect those to be the ones referenced.

I think it would be worth preserving these at least in a NOTE, for documentation purposes.

Totally fair; I'd expect that to be an entry in Annex E.

Generator and AsyncGenerator are top-level types

Not sure what you mean by top-level types. Neither is directly referenceable from the global object.

The way you get at %Generator% in userland is by doing (function*(){}).prototype, and the way you get at %GeneratorFunction% is by doing (function*(){}).prototype.constructor. So %Generator% can be written %GeneratorFunction.prototype%.

Sure - but if they were exposed, that's what would be.

Happy to chat on the call tho about preferring one over the other. Is there any contention about any of the globally-exposed intrinsics, and the intrinsics that are otherwise reachable dotting off of them?

Sure - but if they were exposed, that's what would be.

Well, no, it would be the object currently called %GeneratorFunction% which would be exposed. %Generator% is more like Function.prototype.

Happy to chat on the call tho about preferring one over the other. Is there any contention about any of the globally-exposed intrinsics, and the intrinsics that are otherwise reachable dotting off of them?

I don't really have strong opinions, I just want it to be settled and written down somewhere.

can we rename them to %(Async)GeneratorFunction.prototype% please, it is very confusing to differentiate "Generator" and "GeneratorFunction"

@devsnek i'm down with that if you do the prior research and ensure HTML and 402 (and other layered specs, if any) aren't using any "old" names.

@ljharb we would still leave the original names in the table

The ultimate goal is to delete the old names entirely imo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wangyi7099 picture wangyi7099  路  5Comments

bkardell picture bkardell  路  3Comments

rwaldron picture rwaldron  路  5Comments

moonformeli picture moonformeli  路  3Comments

AlexSHoffman picture AlexSHoffman  路  3Comments