-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
improved function partial application design #56518
base: master
Are you sure you want to change the base?
Conversation
83d2606
to
ac0a69e
Compare
3549ca3
to
0ea9693
Compare
look, I'm not trying to be the bad guy on all your PRs. but I feel like you are misrepresenting the status quo
this is already not possible with
|
I'm not misrepresenting anything, this is the (embarrassing) behavior on master: julia> Base.Fix{-1}
Base.Fix{-1} |
try constructing it? |
Could you please take your off-topic chatting to Discourse or wherever? |
it was a direct and objective refute to one of the primary motivations you provided in the commit message. it feels pretty on topic to me. that being said, you clearly don't want my input, so I'll stop providing it (as, I suspect, will everyone else) |
This replaces `Fix` (xref JuliaLang#54653) with `fix`. The usage is similar: use `fix(i)(f, x)` instead of `Fix{i}(f, x)`. Benefits: * Improved type safety: creating an invalid type such as `Fix{:some_symbol}` or `Fix{-7}` is not possible. * The design should be friendlier to future extensions. E.g., suppose that publicly-facing functionality for fixing a keyword (instead of positional) argument was desired, it could be achieved by adding a new method to `fix` taking a `Symbol`, instead of adding new public names. Lots of changes are shared with PR JuliaLang#56425, if one of them gets merged the other will be greatly simplified.
0ea9693
to
8b2e9ef
Compare
Why does every PR now try to push in this "typed domain numbers" package into Base..? As has been said regarding
so it is unclear what is being improved here. I don't really understand what the other benefit means. |
From what I can tell, this PR comprises three changes that are related, but could be considered independently:
I agree that 1. might make future extensions to e.g. fixing keyword arguments more seamless, but could just be introduced when the time is ripe. If we expect the type to change in the future, this function might give the needed indirection to make that less breaking, but that is quite speculative. |
This replaces
Fix
(xref #54653) withfix
. The usage is similar: usefix(i)(f, x)
instead ofFix{i}(f, x)
.Benefits:
Fix{:some_symbol}
orFix{-7}
is not possible.fix
taking aSymbol
, instead of adding new public names.Lots of changes are shared with PR #56425, if one of them gets merged the other will be greatly simplified.