-
Notifications
You must be signed in to change notification settings - Fork 108
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
Allow const
keyword to prevent extra closure allocations when using pipelines with higher order functions
#230
Comments
Hey, thanks for the good suggestion. (Context for this thread comes from #221 (comment) and #221 (comment)). I appreciate this idea, since it tries to directly address a key disadvantage of F# pipes and PFA syntax, both which I like. Unfortunately, it would probably run into several problems. In fact, I do kind of recall the champion group talking a long time ago about something like this before when we were trying to figure out ways to make F# pipes + PFA syntax (without Hack pipes) more optimizable. (To recap #221 (comment), performance concerns were not the only important concerns that F# and PFA syntax have encountered from TC39 representatives over the years, but they were still ones that we have to address before unsuccessfully.) From what I recall, the main problems we figured with a “baking” syntax included:
I appreciate this idea, since it tries to directly address a key disadvantage of F# pipes and PFA syntax, both which I like. I think it is unlikely that we would pursue such an approach, which has and would continue to encounter concerns such as those I listed above. (My apologies if this answer is discouraging! We really do appreciate the suggestion.) |
I believe it would be appropriate to close this issue, as it would be a significant separate proposal from the pipeline operator, and not really appropriate to pursue as part of this proposal. (Like partial-application, which while entangled with pipeline is a completely separate proposal.) Thoughts? |
I’m fine with closing. I think that it is not viable for the reasons I gave above (non-lexical scoping is probably difficult for both developers’ reasoning and engine implementation). But I do appreciate the thought behind this proposal! |
I've been thinking about the memory issues outlined in #221, and wondered about the possibility of adding the following syntax to let people "bake" the closures from curried/higher order functions when performance is a concern, like this:
A bigger example using F# pipes:
The text was updated successfully, but these errors were encountered: