public aliases to private/package symbols
Peter Alexander
peter.alexander.au at gmail.com
Tue Jan 24 15:09:22 PST 2012
On Tuesday, 24 January 2012 at 22:26:37 UTC, Nick Sabalausky
wrote:
> This whole issue is literally *NO* different from "Should a
> public pointer/reference be allowed to point to private data?"
> or "Should a public function be allowed to expose a private
> one?" The answer is: "Obviously yes".
Things can be obvious in different ways.
For example, one could argue that it's also obvious that an alias
should behave exactly the same as the thing it aliases. Allowing
aliases to change protection would break that.
For the record, I agree that the answer should be "yes", but it's
not a decision that should be made rashly. If we aren't careful,
we could introduce a hole in the protection system in a
non-obvious way. C++'s protection system has a non-obvious hole:
http://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html
Again, I agree, but what's obvious isn't always true, so it needs
to be considered in depth.
More information about the Digitalmars-d
mailing list