digitalmars.D.bugs - visibility bug
- David Medlock (24/31) Jan 10 2006 // vis.d
- Walter Bright (4/5) Jan 15 2006 No. Just as in C++, access checks are done *after* name lookup and overl...
- Chris Miller (15/21) Jan 15 2006 This sucks. Sorry, but why should something completely unusable and
- jcc7 (16/40) Jan 18 2006 We either need to convince Walter it's a bug, or he need to convince us ...
- Sean Kelly (5/20) Jan 18 2006 Agreed. And this simply isn't an issue in C++, as implementation
- =?UTF-8?B?SmFyaS1NYXR0aSBNw6RrZWzDpA==?= (10/30) Jan 19 2006 IMHO -H option is not a proper solution here - private really means
- David Medlock (10/45) Jan 19 2006 I agree. The namespace should not be polluted with private members.
- Don Clugston (16/67) Jan 19 2006 Indeed. Especially since it's an identifier conflict rather than a true
- Bruno Medeiros (22/111) Jan 19 2006 My vote goes too to the side that thinks this behaviour is not ideal,
- Ameer Armaly (6/51) Jan 19 2006 I agree. Private members should be just that; invisible to all but thos...
- Lars Ivar Igesund (10/17) Jan 19 2006 This is a bug. Please fix.
Manfred Nowak wrote:David Medlock wrote:// vis.d import std.stream, std.ctype, std.stdio; void main( char[][] args ) { char c = ' '; if ( isdigit(c) ) writefln( "Hello World" ); } which gives( DMD 0.141, WinXP ): ---------- Capture Output ----------"Z:\dmd\bin\dmd.exe" -c F:\proj\d\test\vis.dZ:\dmd\bin\..\src\phobos\std\stream.d(2912): function std.stream.isdigit conflicts with std.ctype.isdigit at Z:\dmd\bin\..\src\phobos\std\ctype.d(32) F:\proj\d\test\vis.d: module vis std.stream.isdigit is privateTerminated with exit code 1.the private members of stream should not even exist outside that module, if I read the specs correctly. -DavidM >The specs installed by my installation of dmd 0.141 only define accessability: not one word on visibility. By the way: `private' symbols cannot be overriden? -manfredYou mean the ones you can't access you want to override? You make no sense. If you are serious, please explain how functions/classes you cannot access are overridden. -David M PS. Reposted to bugs NG where I intended it. Do you consider this a bug Walter?
Jan 10 2006
"David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.
Jan 15 2006
On Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:"David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before. Possible solutions: 1) Fix it in the compiler. 2) Give your privates strange names; but you can't do that if it's an extern, e.g. accessing external C functions. 3) Always use fully qualified names, but now we're back to the C way of always typing the most possible. 4) Document the privates. e.g. Ddoc could output a "Warning" section saying "avoid these names:". 5) See the compiler's output and fix conflicts as they happen, making you do extra work if you switch compilers / libraries / versions / etc.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.
Jan 15 2006
In article <op.s3fs1jkypo9bzi moe>, Chris Miller says...On Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:There's an isdigit in std.stream? Why? This particular situation is bizarre!"David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.Possible solutions: 1) Fix it in the compiler.We either need to convince Walter it's a bug, or he need to convince us what the compiler is doing makes sense. ;) If isdigit doesn't show up in Ddoc, why does the compiler try to use it?2) Give your privates strange names; but you can't do that if it's an extern, e.g. accessing external C functions.I can already imagine someone defending "__is_____digit__" as an appropriate name. :(3) Always use fully qualified names, but now we're back to the C way of always typing the most possible.You probably already know this, but you can (at least partially) avoid fully qualified names with an alias for your favorite: For example: alias std.ctype.isdigit isdigit;4) Document the privates. e.g. Ddoc could output a "Warning" section saying "avoid these names:".Interesting idea, but I suspect the info would come later than needed if it's output from Ddoc.5) See the compiler's output and fix conflicts as they happen, making you do extra work if you switch compilers / libraries / versions / etc.If I understand what you mean right, this is probably the status quo for most people (i.e. what they've already been doing). jcc7
Jan 18 2006
Chris Miller wrote:On Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:Agreed. And this simply isn't an issue in C++, as implementation details can be hidden in source files. Though I guess they can in D as well now that we have the -H compiler option. Sean"David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.
Jan 18 2006
Sean Kelly wrote:Chris Miller wrote:IMHO -H option is not a proper solution here - private really means private and should be "hidden" from the other modules even when we have access to the full source code. This really sucks and is the most annoying thing in D to me. Walter, please think of a project with tens of thousands of classes. How should one know, whether a method name is already "reserved" in another module or not? -- Jari-MattiOn Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:Agreed. And this simply isn't an issue in C++, as implementation details can be hidden in source files. Though I guess they can in D as well now that we have the -H compiler option."David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.
Jan 19 2006
Jari-Matti Mäkelä wrote:Sean Kelly wrote:I agree. The namespace should not be polluted with private members. The whole point of private is 1. To prevent namespace conflicts 2. To isolate the replaceable(implementation) aspects of your module private parts(hehe) then why should I see them? Walter, pragmatically this rule makes no sense for C++ or D. ( At least across modules it doesnt) -DavidMChris Miller wrote:IMHO -H option is not a proper solution here - private really means private and should be "hidden" from the other modules even when we have access to the full source code. This really sucks and is the most annoying thing in D to me. Walter, please think of a project with tens of thousands of classes. How should one know, whether a method name is already "reserved" in another module or not?On Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:Agreed. And this simply isn't an issue in C++, as implementation details can be hidden in source files. Though I guess they can in D as well now that we have the -H compiler option."David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.
Jan 19 2006
David Medlock wrote:Jari-Matti Mäkelä wrote:Indeed. Especially since it's an identifier conflict rather than a true ambiguity.Sean Kelly wrote:Chris Miller wrote:IMHO -H option is not a proper solution here - private really means private and should be "hidden" from the other modules even when we have access to the full source code. This really sucks and is the most annoying thing in D to me.On Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:Agreed. And this simply isn't an issue in C++, as implementation details can be hidden in source files. Though I guess they can in D as well now that we have the -H compiler option."David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.I agree.Walter, please think of a project with tens of thousands of classes. How should one know, whether a method name is already "reserved" in another module or not?I agree. The namespace should not be polluted with private members. The whole point of private is 1. To prevent namespace conflicts 2. To isolate the replaceable(implementation) aspects of your moduleprivate member, you risk breaking code elsewhere. --> you can change the behaviour of private members, you can delete them , but you cannot add new ones safely. This is not much of a problem for class members, but for free functions and templates, it's a real issue. Try putting a private function in std.stdio called void func() {} and see how many test programs break. If I cannot call or extend theprivate parts(hehe) then why should I see them?Walter, pragmatically this rule makes no sense for C++ or D. ( At least across modules it doesnt)This has never once been a problem for me in C++, but I'm encountering it all the time in D.
Jan 19 2006
Don Clugston wrote:David Medlock wrote:My vote goes too to the side that thinks this behaviour is not ideal, and should be improved/fixed.Jari-Matti Mäkelä wrote:Indeed. Especially since it's an identifier conflict rather than a true ambiguity.Sean Kelly wrote:Chris Miller wrote:IMHO -H option is not a proper solution here - private really means private and should be "hidden" from the other modules even when we have access to the full source code. This really sucks and is the most annoying thing in D to me.On Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:Agreed. And this simply isn't an issue in C++, as implementation details can be hidden in source files. Though I guess they can in D as well now that we have the -H compiler option."David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.I agree.Walter, please think of a project with tens of thousands of classes. How should one know, whether a method name is already "reserved" in another module or not?I agree. The namespace should not be polluted with private members. The whole point of private is 1. To prevent namespace conflicts 2. To isolate the replaceable(implementation) aspects of your moduleprivate member, you risk breaking code elsewhere. --> you can change the behaviour of private members, you can delete them , but you cannot add new ones safely. This is not much of a problem for class members, but for free functions and templates, it's a real issue. Try putting a private function in std.stdio called void func() {} and see how many test programs break. If I cannot call or extend theprivate parts(hehe) then why should I see them?It should be because of C++'s namespacing structure, no? C++'s namepacing structure allows for a programming style where most non-local entities are acessed by partially qualified names and not unqualified names. In D the same is (possible, altough) not so easy or flexible to do. Unlike other languages, D is geared torwads the use of unqualified names, and then such problems arise. In Java the problem is different: Since classes take the role of modules and latter name qualifiers, all possible conflicts arise at import time. Changing D's naming methodology might deal with this problem, but I think that it might not be the best way. I'm not totally experienced on this, but I guess I agree with the disambiguation ideas proposed here. Note: Nonetheless, I do *inexorably* think that D's naming structure & methodology should, if not *must*, be changed. It is however, for different reasons. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural."Walter, pragmatically this rule makes no sense for C++ or D. ( At least across modules it doesnt)This has never once been a problem for me in C++, but I'm encountering it all the time in D.
Jan 19 2006
"David Medlock" <noone nowhere.com> wrote in message news:dqoc32$6vs$1 digitaldaemon.com...Jari-Matti Mäkelä wrote:I agree. Private members should be just that; invisible to all but those permitted to see them. I mean, why should I care if my function has the same name as a private function defined in another module; it just doesn't play in to the grand scheme of things.Sean Kelly wrote:I agree. The namespace should not be polluted with private members. The whole point of private is 1. To prevent namespace conflicts 2. To isolate the replaceable(implementation) aspects of your module parts(hehe) then why should I see them? Walter, pragmatically this rule makes no sense for C++ or D. ( At least across modules it doesnt)Chris Miller wrote:IMHO -H option is not a proper solution here - private really means private and should be "hidden" from the other modules even when we have access to the full source code. This really sucks and is the most annoying thing in D to me. Walter, please think of a project with tens of thousands of classes. How should one know, whether a method name is already "reserved" in another module or not?On Sun, 15 Jan 2006 05:17:56 -0500, Walter Bright <newshound digitalmars.com> wrote:Agreed. And this simply isn't an issue in C++, as implementation details can be hidden in source files. Though I guess they can in D as well now that we have the -H compiler option."David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This sucks. Sorry, but why should something completely unusable and undocumented cause conflicts. I do run into this problem quite often, and I believe I've made a NG post about it before.Do you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.-DavidM
Jan 19 2006
Walter Bright wrote:"David Medlock" <noone nowhere.com> wrote in message news:dq1l4p$8dq$1 digitaldaemon.com...This is a bug. Please fix. It doesn't matter what C++ do, because for some reason this is not an issue there. It's been said dozens of times, D leads to new ways of programming, and then it is just silly to have a feature that leads to conflicts, when the logical solution actually fix it. Logically, private is just another type of scope. The members should not be accesible outside of this. Put it in the spec, and you got another improvement over C++. Lars Ivar IgesundDo you consider this a bug Walter?No. Just as in C++, access checks are done *after* name lookup and overload resolution.
Jan 19 2006