import concerns (was Re: Historical language survey)
Sean Kelly
sean at f4.ca
Sat Jul 8 09:00:26 PDT 2006
Walter Bright wrote:
> Derek Parnell wrote:
>> I'm sorry Walter but I don't give newt's fart about C++. If I wanted
>> to code under the rules of C++, I'd use C++. You have changed
>> (improved) many of the C++ rules in D, so why not get this one right too?
>
> I agree that D exists to fix broken rules in C++, but we need to
> understand the rationale for why they are the way they are in C++, else
> we run the risk of making a severe error. I don't recall why the access
> rules are the way they are in C++, but I do know they weren't don't that
> way for backwards compatibility.
Please see my post here:
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/39072
According to Daveed Vandevoorde:
The fact that private members are inaccessible but not invisible
regularly surprises incidental programmers. Like macros, seemingly
unrelated declarations interfere with subsequent code. Unfortunately,
there are good reasons for this state of affair: Without it, private
out-of-class member declarations become impractical to parse in the
general case.
So assuming he's right (I couldn't find the minutes of the original
meetings to back up his claim) then the decision was made fore purely
technical reasons, and reasons that don't seem to apply to D because of
the different meaning of 'private'. Daveed goes on to say:
Module namespaces appear to be an ideal boundary for making the
private member fully invisible: Within the module the implementer has
full control over naming conventions and can therefore easily avoid
interference, while outside the module the client will never
have to implement private members. (Note that this also addresses the
concerns of N1602 "Class Scope Using Declarations & private Members"
by Francis Glassborow; the extension proposed therein is then no
longer needed.)
(note that this is the proposal for modules in C++)
I know you've read the proposal, but it's available here for those who
don't want to follow my link above:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1964.pdf
Sean
More information about the Digitalmars-d
mailing list