[Issue 6180] Private has no effect on types in modules

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 6 03:51:53 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6180



--- Comment #13 from dawg at dawgfoto.de 2012-09-06 03:52:07 PDT ---
>D takes it access modifier design from C++, and it's purely a question of
accessibility, not visibility, even if many people expect it to affect
visibility.

C++ doesn't have access modifiers on global scope, only within classes/structs.
It's primarily needed to restrict access while making all fields visible for
the memory layout.
The C++ way of hiding symbols is to not expose them in headers and using
anonymous namespaces for sources.
Using access modifiers for types and functions in D's source only modules has
no equivalence in C++. And because unqualified imports are the default we're
getting namespaces clashes as with header includes. The hijack protection is
only a safety net but it doesn't protect against breaking software.

Reading the first paragraph of http://dlang.org/hijack.html it becomes clear
that we missed an important design goal.

>The mod­ule developers must be able to maintain and improve those modules without inadvertently stepping on the behavior of modules over which they cannot have knowledge of.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list