-
-
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
Common pool for methods as a way to solve common names in different packages #2327
Comments
Crazier idea: share to a namespace (represented by a metapackage?) that semantically-equivalent packages could share. That gives some granularity to the sharing mechanism. Possibly either too crazy or overkill. |
This might be off-topic, but the hierarchical module idea is interesting. Instead of module A
# implicit 'using Base'
import Base.x, Base.y
end
baremodule B
...
end you could write something like module A <: Base
import x, y
end
module B
...
end |
Using the |
It is an interesting idea, but having a near-obligatory |
If @nolta's proposal was meant as a response to my comment, my crazy idea isn't quite the same. I'm wondering if instead of a single common namespace pool, we could have an arbitrarily large number of namespace pools which would emerge by domain: instead of |
I also like the idea of common namespace pools, but I think that the solution is primarily about how to reach consensus about what a given generic function means, not about adding new language features. If you use a common name without prior consensus, you are bound to run into trouble sooner or later. Consider two modules
If I see the consensus process something like this:
This way, common concepts will gradually merge into common generic functions, percolating down the dependency graph towards The immediate need seems to be somewhere to house common generic functions that don't belong in Some language support will also be helpful:
|
Thanks, that explains things much better, though the focus on a The difference between that and my previous comment is the formality of the relationship. |
The one concern I have with these proposals is discoverability: suppose that I fumble around and develop a function called X. How long will it be before I realize that my X is called Y in the Concepts1235 package? |
If you are calling what everyone else is calling "Y" "X", there is no discoverability except by discussion with your peers. I'm not sure how any of these proposals, even the simplest name pool one, can fix that. |
Hopefully, common users of packages will alert both maintainers of similar |
Sorry for not giving credit where credit is due. I didn't see my post as a new proposal, but as trying to flesh some of the ideas that came before. About discoverability: I also don't think that this is worse than anything else that we could come up with. (But please write if you come up with ways that work better in this respect.) I didn't intend that you should create the concepts to sit idly in the dark until someone would realize that they should implement them; a concept wouldn't be added until there were at least two uses. So you would at least have the chance to realize that you wanted the same concept as one of those. Hopefully the common concepts should also become documented sooner or later. Also, I think that the same concept could very well be imported from the point of common definition into dependent concepts modules. This would be natural if a concept was first created in one context, and then became more widely adopted. By importing appropriate concepts into more specific concepts modules (if there would be several), it might be easier to find the concept you are looking for when looking in the place where you think it would be. |
This is definitely a real problem, but triage thinks we won't implement this specific solution. The leading candidate solution for this kind of thing is method merging, and/or to continue to make packages like |
DataFrames exports many methods that use common names, like
cut
,by
,in
,index
,matrix
,range
, andwith
. If another package comes along and defines and exports their own methods of the same name, the user can no longer just type the method name and expect it to work. They'll have to preface the function with the module name.@johnmyleswhite describes the issue well here:
https://groups.google.com/d/msg/julia-stats/zHFIOdQp664/dvohHm54Tm8J
@JeffBezanson's two cents:
https://groups.google.com/d/msg/julia-stats/zHFIOdQp664/I9Vu68prr-UJ
Maybe we could have a new keyword called
shared
that is something likeimport
, but it uses a module calledCommon
as the pool of common method definitions. Another feature that would be nice is to keepCommon.fun1
separate fromMyModule.fun1
in case there are overlaps. That might complicate things too much, though.The text was updated successfully, but these errors were encountered: