tc39 / proposal-extensions

Extensions proposal for ECMAScript
MIT License
150 stars 6 forks source link

Rename the proposal from "extensions" to "static dispatch operator" #13

Closed hax closed 1 week ago

hax commented 2 years ago

Currently the proposal is named as "Extensions and :: operator". I'm considering rename it to "static dispatch operator" (contrasts with . and [], which are dynamic dispatch operators).

Though extension methods/accessors are the important motivation/use cases of the proposal, there are also other motivation/use cases. For example utilize :: operator to get good syntax for first-class protocol and static invoking in the classes.

Another issue is not every people know extensions concept well, and it also has different with extensions of other programming languages (use :: operator instead of . operator, has receiver::X:foo form).

So renaming the proposal to "static dispatch operator" could give the more precise description --- provide a form of method dispatch which resolve the method/function statically, contrasts with a.foo and a["foo"] which resolve the method/function dynamically.

As such renaming, Symbol.extension will also be renamed to Symbol.dispatcher.

hax commented 1 week ago

I plan to change the syntax to dot based (eg. receiver.x'foo), so let's keep the word "extensions".

x'foo could be seen as a "compound identifier" which is two identifiers combined by the separator, so the proposal name might become "extensions and compound identifier".