Open ronag opened 3 years ago
@benjamingr I'm not sure we even need #39067 if we do it like this?
Some limitations/problems with this approach:
this
with e.g. bind or arrow functions.async function (source)
as this approach requires a yield
.I actually like passing signal and the source stream explicitly I think it's more obvious and makes it clear they need to be used.
I think using this
is a bit quirky here
Also, what ever happened to function.sent? @ljharb is it just blocked on people actually caring/doing the spec work?
I wonder if this has any performance benefits.
@benjamingr yes, the previous champion no longer participates in TC39, and it was about to be made inactive, but then another delegate took it up, but nothing's been done with it.
Just an idea for discussion:
Currently we support creating transform streams from async generators:
However, after reading through https://github.com/tc39/proposal-function.sent I realize there is an alternative possible syntax:
Which has an advantage of avoiding the extra parameter required in toUpper and could unify the signature of readable and transform generators.
I'm not sure about whether or not this is a good idea. Mostly wanted to raise awareness of the possibility and see what others think.
I believe we could probably achieve a similar syntax pre this proposal by replacing
function.sent
withthis.sent
for use withpipeline/compose
as a compat. It would have the same value asfunction.sent
for forward compatibility.Example how this could be implemented: