12/22/2012 12:21 PM, Walter Bright пишет:
On 12/21/2012 11:23 PM, Jonathan M Davis wrote:
But we _want_ that. The fact that inaccessible functions are even
considered
in overload sets is horrible. That's precisely the problem. No
inaccessible
functions should be in overload sets. Otherwise, simply adding a private
function to a module can break code elsewhere. I don't see _any_
benefit in
having inaccessible functions be in overload sets. It's leaking
implementation
details outside of the scope that they're in and breaking code
elsewhere when
changes are made. What do you think is so desirable about having
inaccessible
functions in overload sets?
It's that way in C++ mainly so that it doesn't make the already complex
overloading system even more so. And in 25 years of working with C++,
I've never seen this make anyone's list of horrible things about C++.
I was afraid you'd say that. Again the way C++ "solves it" is by hiding
stuff behind header files or (for templates) using horrible internal
namespaces.
They don't have access modifiers at the global scope but namespaces were
a tool to solve name collisions. In the end it's still relies on
convention e.g. some namespaces are not meant to be accessed outside of
specific files.
See e.g. Boost c++, as an example of code using this _workaround_
everywhere.
--
Dmitry Olshansky