-
-
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
Duck type the function in map, reduce, etc. #10312
Conversation
This is motivated by the existence of call-overloading
I do agree with the duck typing part. Soon we will want to make |
Sure, but this doesn't change that---it's always been that way.
It is, but existing constructs like |
My solution would be to leave it alone for now :) I find the My "textbook" answer to explain the ambiguity of |
If that means we can expect something soon, I'm all in favor :). But actually soon, not "someday" :). |
Not promising anything amazing, I just don't think we should rush to add |
Well, all that is fair---and I agree with you on the Regex method. How about I explore how many methods need to be deleted to avoid ambiguities without introducing |
Jeff, everything you do is amazing. |
Wow, I'm glad you balked. It turns out that Regex method was the only problem spot. See #10314. |
Now that we have call-overloading, it would be nice to be able to use it in functions like
map
,reduce
, etc. However, call-overloaded objects can be of any type, which makes it seem necessary to duck-type the "function" passed as an argument tomap
and friends.The main design criterion in this PR was to avoid method ambiguities, particularly with packages that might overload either the "function type," the "container type," or both. For better or worse, I therefore decided to make it trivial to overload these by making the exported symbols basically not use any kind of typing, and to perform dispatch on the container through a non-exported family of functions with a
c
on the end.