-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: Should F#-style pipelines support yield? #90
Comments
I'd rather leave those unary operators (
The same pipeline could see different Promise values being fed to
Edit: fI see that @js-choi also mentioned |
This wouldn't work since |
Oh, yes, my bad, time to go to bed :-) |
You could make it an async arrow, but that would end up propagating promises down the chain. As I mentioned in #75, I see So, anything that allows me to have |
I think that despite how it might be spec'd or implemented, |
Can you explain? |
Sorry, hit enter too soon; I mean conceptually very different things. (That the default babel transpilation of |
The async-to-gen wrapper functions the same way, the wrapper doesn't iterate multiple values. But inside the async function (and the generator in the wrapped form), it is producing multiple sync values. It's just waiting for the promise to resolve before pulling the resuming (or pulling the next value out the generator).
It's unbelievably difficult to implement async-to-promise. I've tried it twice, and failed miserably both times. Exponential code bloat, edge cases that are hard to statically catch. I imagine async-to-gen will be relevant for a long time. |
This issue applies only to one of the four current proposals: F#-style/call pipelining. It does not apply to Hack-style/binding pipelining or the two mix proposals. The issue is a thing insofar that Maybe the title should be changed to clarify that it applies to the F#-style proposal only? Wrangling all these proposals and their issues is confusing enough; clearly narrowing the scope here may help discussion. |
Took care of this for now. Will share some other thoughts tomorrow. |
This is one type of behavior you can model with generators, But any arbitrary generator wrapper function can implement any given behavior. My inclination is to think this uncontrolled nature of However, I think we might be able to optimize yield x |> double
|> add1
|> square
// desugar to
yield square(add1(double(x))) I think that would optimize for the most common case. All of that said, I don't know if it's actually that difficult to support |
As in the initial comment, I don't think By contrast, |
What is the rationale for creating an ad-hoc solution for |
Oh, I missed the "if" part of that statement. Sorry! |
@zenparsing Well, if something else like |
I'm going to go ahead and close this as "no, it shouldn't". If anyone still objects, we can reopen / revisit this decision. |
Relevant pieces from #75:
@zenparsing (#75 (comment))
@mAAdhaTTah (#75 (comment))
@jridgewell (#75 (comment))
@mAAdhaTTah
@jridgewell (#75 (comment))
That should lay out the two perspectives. Follow on comments from the above conversation can be found in #75. Some additional conversation can be found in #66.
The text was updated successfully, but these errors were encountered: