Open cshaa opened 6 years ago
I found #44 has active discussion.
Mostly this proposal is near dead. But I think it could revive to two separate proposals:
method extraction, suppose the syntax is
a.&b
and a[&b]
, or&a.b
and &a[b]
And support const {&b} = a;
for destructuring.
extension methods/accessors, suppose the syntax is
a::b()
a::b = 1
@hax I'm confused. How would method extraction work? You'd pull out a method from an object so that you can call it with a specific binding ?
@zfrisch I believe the idea is to extract a method whose receiver remains bound to the object it's extracted from.
@zfrisch imagine, const slice = []::slice; slice(arraylike)
rather than Array.prototype.slice.call(arraylike)
@ljharb Wouldn’t that be const slice = [].slice; arraylike::slice()
? Or, to use method extraction, const slice = ::Array.prototype.slice.call; slice(arraylike)
.
@charmander to correctly extract it, you'd need
const slice = ::Array.prototype.slice.call;
// or
const slice = ::[].slice.call;
slice(array);
same question + 1
I need this feature.
I'd like to champion this proposal and reshape it. But I first need ask the original champions or tc39 committee whether it was possible.
I loved this feature when it was first introduced with babel. So sad seeing it die.
FYI: There are currently three active rival TC39 proposals that are trying to subsume this inactive proposal:
There will be some further discussion at the next plenary meeting in January 2022 about these proposals (see “Holistic review of dataflow proposals” in tc39/agendas#1106). So there’s still ongoing activity in this problem space.
Are there any updates on the state of this proposal? I find both the unary and the binary variant to be very useful and esthetic and I would definitely use them. The problem is that it hasn't been getting any updates for ages and the developers of libraries like TypeScript are afraid to implement it, because it's still an early draft. So what is the current status of this feature? Is it going to get promoted to Stage 1 anytime soon?