proposal-extensions icon indicating copy to clipboard operation
proposal-extensions copied to clipboard

Extensions proposal for ECMAScript

Results 15 proposal-extensions issues
Sort by recently updated
recently updated
newest added

I saw the proposal is `const ::toArray=...` now. Why not `const toArray=...` simply, like old proposal did?

One use case of this proposal is providing good syntax for first-class protocol: ```js protocol MyProtocol { foo bar() { this::foo() // instead of this[MyProtocol.foo]() which is wordy and unsafe...

Currently the proposal is named as "Extensions and `::` operator". I'm considering rename it to "[static dispatch](https://en.wikipedia.org/wiki/Static_dispatch) operator" (contrasts with `.` and `[]`, which are [dynamic dispatch](https://en.wikipedia.org/wiki/Dynamic_dispatch) operators). Though extension...

## Current design and the pitfalls `value::X:foo(...args)` currently support both constructors and namespace objects by default. For constructors, it works as `X.prototype.foo.call(value, ...args)`. For namespace objects, it works as `X.foo.call(X,...

Node contains a lot of methods that are uncurry the value of `this` in order to safely obtain functionality like `[0, 1].slice()` that is not subject to prototype pollution. This...

As per the discussion from the Nov 2020 TC39 meeting: what would be the relation between this proposal and the [pipeline operator proposal](https://github.com/tc39/proposal-pipeline-operator)? Would they be mutually exclusive or would...

```ts const ::example = { get() { console.log(1); } } const get = function () { console.log(2); } const cond = Math.random() > 0.5; cond ? null::example:get(); // How will...

Looks like the ways arguments was passed will be altered depends on how you organize the extension? Besides that. The `ConstructorExtension` don't expose the object the method was on (a.k.a....

```js // util.js export const toSet = iterable => new Set(iterable) ``` ```js import * as util from './util.js' []::util:toSet();// why here equals to `util.toSet([])`, but not `util.toSet.call([])`? ``` If...

If the only motivation for isolated namespace is to prevent shadowing, I think we can make shadowing extensions becomes an early error.