-
Notifications
You must be signed in to change notification settings - Fork 4
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
WISH: apply
design to cover function extension cases
#171
Comments
Other than the need for a "passive mode" for the values block, the task of extending a function has another requirement: The new function could have more arguments as it supports new refinement and args. So, if you call the old function, you need to match 1 -1 the existing arguments in both sides. This could be accomplished in an easy way if you support either:
In this way: a simple
With this technique: |
Actually this was pretty much covered by the |
So you are proposing that if you pass a word, its context is used. If you support this, then supporting objects should be 1 line of code difference or less. |
It was originally one of the use cases: here and here and here
Currently still, general extension of other functions with
apply
is quite convoluted. Example - extend any function with a single print statement:In the above I have to parse and arrange an argument list, fill it with get-words to avoid double evaluation, then on every invocation
compose
it to prepare values for possible get-args.Test:
This wish is to have an easy extension without the need for composition on each call.
The text was updated successfully, but these errors were encountered: