-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use leading underscores everywhere on internal functions #94
Comments
I don't think it is our responsibility to prefix every private function. If we really want to make private stuff private, we could use the following pattern: module ConstructionBase
function setproperties end
function getproperties end
...
module _Private
import ..ConstructionBase: setproperties, getproperties, ...
include("some.jl")
include("files.jl")
...
end
end |
I'm not sure I see the reasoning, underscores are less fuss and everyone knows what they mean. And most of my packages use underscores and a lot of Base Julia does, it's not an unusual thing to do. |
Sure, it is about the "everywhere" part. Typically some internal functions are prefixed with |
I'm just thinking about the relative scale of that discipline vs the massive ecosystem outages confusion about our methods can cause. (to clarify, I mean just putting underscores is a tiny effort vs other package devs frantically patching versions to make hundreds of packages work) |
Prefixing every function with module ConstructionBase
function getproperties end
function setproperties end
...
# Internal functions that are de facto used by other packages however
# we keep them here to not break these packages
function setproperties_object end
...
|
Yes you can do the same thing either way. I'm just not sure why we would do something different to what Base julia and most people do, which is use underscores. But if you really want separate modules sure. The idea of this post was to respond constructively to breaking half of the SciML ecosystem. |
I read your opening post as a higher bar than what base julia or other packages do. Not all internals of Base are prefixed, internals of Base get used all the time and nightly breaks some ecosystem every day or so. My understanding was you want to be fully rigorous about what is private. In this scenario my suggestion was to |
Anyway if you make a PR that adds underscores everywhere I am not going to object. |
This package is very small, so the ratio of dependencies to lines of code is actually much higher than Base Julia! So I would argue effort/reward for things like this is higher here. See when I have time for the PR, but I think we should also deprecate the non-underscore functions so people get a warning to stop using them. |
Even with the new public keywords we need to make internals look scary, the consequences of changing them is too large now.
See #92
(Although doing this now ironically risks massive ecosystem breakage, so maybe just with new functions...)
The text was updated successfully, but these errors were encountered: