-
Notifications
You must be signed in to change notification settings - Fork 17
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
Reconsider overloading Base.join #58
Comments
To add to this:
There's no problem using those in your package if you don't export them (or don't override the Base version), but the rule of thumb is that if they override something in |
I don't see a strong reason why the same function name can't support multiple concepts as long as both concepts are explained in the docstring, which they are. I think it's pretty clear based on the arguments what these methods do and how they differ from other base methods. I suppose an ideal solution would be if Julia supported dynamic method merging, so that we don't need to explicit extend base to avoid conflicts. In any case, I'm not inclined to change the API of this package just to hack around a current limitation of the language. |
FWIW, the fact that functions have meaning (and are not just random names in a namespace that can be arbitrarily merged) Is pretty fundamental for generic programming. This is not a limitation of the language and it is exactly the same in other programming languages with generic concepts. For example C++ has the same recommendation
Or in the Julia docs
Anyway, just opened this issue in case of these extension being mostly by accident |
Okay, it's your package. 👍 One of the advantages of using the same method names (and interfaces) is that 3rd parties could easily switch between You do provide aliases for most of the common functions ( Would you consider making that more obvious in (I'd be willing to make a PR...) |
Thanks, yeah, it was an intentional compromise when designing the API. I don't mean to be rude by disagreeing or closing. My view was that it seems redundant to writing things like
Yes, that was the idea. For example, I believe
👍 Yes, if you feel like there is missing functionality or aliases for Base / Filesystem functions please feel free to open a PR to FilePaths.jl (if it's low-level enough it might belong here). There is already some code there to help with switching (e.g., a macro for writing APIs that can operation on both strings and filepaths). |
I still feel like a single function can support multiple concepts based on the context of how its called (e.g., types passed in), but since it seems unlikely that julia will support method merging in the future I'll just change it and move on. Changes:
|
Base.join
has a clear docstring which is to join an array of strings with delimiters. This seems like a different operation than what the join on types in FilePathsBase provides. Base already has a function that has the intended meaning which isjoinpath
. So, to me, just removing overloadingjoin
and just usingjoinpath
would be a good idea.The text was updated successfully, but these errors were encountered: