Re: Module-level accessibility

2010-10-26 Thread Bruno Medeiros
On 05/10/2010 08:27, Jacob Carlborg wrote: If you have two classes in one file in Java you can access private methods from the other class. Only if one class is nested in the other. -- Bruno Medeiros - Software Engineer

Re: Module-level accessibility

2010-10-06 Thread Jonathan M Davis
On Wednesday, October 06, 2010 05:39:24 Steven Schveighoffer wrote: > You must not have read my prior post. Well, I believe that I did read your previous post, but I probably read it too quickly. > Given this class: > > class A > { >abstract private void foo(); > } > > You can construct a

Re: Module-level accessibility

2010-10-06 Thread Steven Schveighoffer
On Wed, 06 Oct 2010 08:23:35 -0400, Jonathan M Davis wrote: On Wednesday 06 October 2010 04:04:24 Steven Schveighoffer wrote: On Tue, 05 Oct 2010 20:27:58 -0400, Jonathan M Davis wrote: > Well, I don't see why it wouldn't be possible for the compiler to > enforce that > overridden privat

Re: Module-level accessibility

2010-10-06 Thread Jonathan M Davis
On Wednesday 06 October 2010 04:04:24 Steven Schveighoffer wrote: > On Tue, 05 Oct 2010 20:27:58 -0400, Jonathan M Davis > > wrote: > > Well, I don't see why it wouldn't be possible for the compiler to > > enforce that > > overridden private methods can't be called by anyone but the base class. >

Re: Module-level accessibility

2010-10-06 Thread Steven Schveighoffer
On Tue, 05 Oct 2010 20:27:58 -0400, Jonathan M Davis wrote: Well, I don't see why it wouldn't be possible for the compiler to enforce that overridden private methods can't be called by anyone but the base class. That being the case, then allowing for private virtual functions is most def

Re: Module-level accessibility

2010-10-05 Thread Jonathan M Davis
On Tuesday 05 October 2010 09:42:14 Steven Schveighoffer wrote: > And when would a protected hook be callable from an unknown/uncontrolled > context? In whose eyes, the base or derived class? > > The thing is, any class that defines a private function implementation is > able to call it. You can

Re: Module-level accessibility

2010-10-05 Thread Steven Schveighoffer
On Tue, 05 Oct 2010 12:07:21 -0400, Andrei Alexandrescu wrote: On 10/5/10 7:40 CDT, Steven Schveighoffer wrote: On Tue, 05 Oct 2010 03:25:03 -0400, Jacob Carlborg wrote: Who says we need to implement it as g++ does? DMD could implement it to not allow that. The derived class controls e

Re: Module-level accessibility

2010-10-05 Thread Andrei Alexandrescu
On 10/5/10 7:40 CDT, Steven Schveighoffer wrote: On Tue, 05 Oct 2010 03:25:03 -0400, Jacob Carlborg wrote: Who says we need to implement it as g++ does? DMD could implement it to not allow that. The derived class controls everything. You cannot take control away from the derived class, it j

Re: Module-level accessibility

2010-10-05 Thread Steven Schveighoffer
On Tue, 05 Oct 2010 03:25:03 -0400, Jacob Carlborg wrote: Who says we need to implement it as g++ does? DMD could implement it to not allow that. The derived class controls everything. You cannot take control away from the derived class, it just can't be done: class A { private voi

Re: Module-level accessibility

2010-10-05 Thread Jacob Carlborg
On 2010-10-04 21:37, bearophile wrote: Andrei: I agree. Class A can access private methods of class B as long as both defined in the same module. If it has access to private methods, why can't it override them? Makes little sense, if you ask me, especially given that user may prevent overriding

Re: Module-level accessibility

2010-10-05 Thread Jacob Carlborg
On 2010-10-05 00:11, Steven Schveighoffer wrote: On Mon, 04 Oct 2010 17:54:54 -0400, Jonathan M Davis wrote: On Monday, October 04, 2010 13:41:38 Steven Schveighoffer wrote: To me, making it private doesn't do anything over protected. A derived class can still call the function in question, b

Re: Module-level accessibility

2010-10-04 Thread Juanjo Alvarez
On Mon, 04 Oct 2010 14:28:32 +0200, Don wrote: may lose interest in the language because of it alone. (The others are bug 3516 and 2451). Eh, I was bitten but 2451 yesterday and actually had to change a lot of function signatures and rethink my code to avoid it. I hope is fixed soon. On

Re: Module-level accessibility

2010-10-04 Thread Steven Schveighoffer
On Mon, 04 Oct 2010 17:54:54 -0400, Jonathan M Davis wrote: On Monday, October 04, 2010 13:41:38 Steven Schveighoffer wrote: To me, making it private doesn't do anything over protected. A derived class can still call the function in question, because it has the implementation. I don't see

Re: Module-level accessibility

2010-10-04 Thread Jonathan M Davis
On Monday, October 04, 2010 13:41:38 Steven Schveighoffer wrote: > To me, making it private doesn't do anything over protected. A derived > class can still call the function in question, because it has the > implementation. I don't see what the point is... > > A derived class from the derivative

Re: Module-level accessibility

2010-10-04 Thread Steven Schveighoffer
On Mon, 04 Oct 2010 16:14:44 -0400, Jonathan M Davis wrote: On Monday 04 October 2010 11:26:17 Steven Schveighoffer wrote: What possible use case could private methods being polymorphic allow? A private method can only be called by the class that contains the implementation. Allowing base

Re: Module-level accessibility

2010-10-04 Thread Jonathan M Davis
On Monday 04 October 2010 11:26:17 Steven Schveighoffer wrote: > What possible use case could private methods being polymorphic allow? > > A private method can only be called by the class that contains the > implementation. Allowing base classes to call it makes no sense. > > Make the method pro

Re: Module-level accessibility

2010-10-04 Thread Steven Schveighoffer
On Mon, 04 Oct 2010 15:14:09 -0400, Andrei Alexandrescu wrote: On 10/4/10 13:27 CDT, Denis Koroskin wrote: And the "package" also implying final is just ridiculous! This I agree with. I agree. Class A can access private methods of class B as long as both defined in the same module. If

Re: Module-level accessibility

2010-10-04 Thread bearophile
Andrei: > > I agree. Class A can access private methods of class B as long as both > > defined in the same module. If it has access to private methods, why > > can't it override them? Makes little sense, if you ask me, especially > > given that user may prevent overriding methods using "final" key

Re: Module-level accessibility

2010-10-04 Thread Andrei Alexandrescu
On 10/4/10 13:27 CDT, Denis Koroskin wrote: On Mon, 04 Oct 2010 22:13:52 +0400, Jonathan M Davis wrote: On Monday, October 04, 2010 10:37:53 Sean Kelly wrote: Andrei Alexandrescu Wrote: > There is still debate on the matter of private methods in interfaces. > Please bring up in this forum any

Re: Module-level accessibility

2010-10-04 Thread Denis Koroskin
On Mon, 04 Oct 2010 22:13:52 +0400, Jonathan M Davis wrote: On Monday, October 04, 2010 10:37:53 Sean Kelly wrote: Andrei Alexandrescu Wrote: > There is still debate on the matter of private methods in interfaces. > Please bring up in this forum any additional pro and con arguments that >

Re: Module-level accessibility

2010-10-04 Thread Steven Schveighoffer
On Mon, 04 Oct 2010 14:29:38 -0400, Denis Koroskin <2kor...@gmail.com> wrote: On Mon, 04 Oct 2010 22:26:17 +0400, Steven Schveighoffer wrote: What possible use case could private methods being polymorphic allow? A private method can only be called by the class that contains the implem

Re: Module-level accessibility

2010-10-04 Thread Denis Koroskin
On Mon, 04 Oct 2010 22:26:17 +0400, Steven Schveighoffer wrote: On Mon, 04 Oct 2010 14:13:52 -0400, Jonathan M Davis wrote: On Monday, October 04, 2010 10:37:53 Sean Kelly wrote: Andrei Alexandrescu Wrote: > There is still debate on the matter of private methods in interfaces. > Please

Re: Module-level accessibility

2010-10-04 Thread Denis Koroskin
On Mon, 04 Oct 2010 22:13:52 +0400, Jonathan M Davis wrote: On Monday, October 04, 2010 10:37:53 Sean Kelly wrote: Andrei Alexandrescu Wrote: > There is still debate on the matter of private methods in interfaces. > Please bring up in this forum any additional pro and con arguments that >

Re: Module-level accessibility

2010-10-04 Thread Steven Schveighoffer
On Mon, 04 Oct 2010 14:13:52 -0400, Jonathan M Davis wrote: On Monday, October 04, 2010 10:37:53 Sean Kelly wrote: Andrei Alexandrescu Wrote: > There is still debate on the matter of private methods in interfaces. > Please bring up in this forum any additional pro and con arguments that >

Re: Module-level accessibility

2010-10-04 Thread Jonathan M Davis
On Monday, October 04, 2010 10:37:53 Sean Kelly wrote: > Andrei Alexandrescu Wrote: > > There is still debate on the matter of private methods in interfaces. > > Please bring up in this forum any additional pro and con arguments that > > you might have. > > What debate? Private methods don't get

Re: Module-level accessibility

2010-10-04 Thread Sean Kelly
Andrei Alexandrescu Wrote: > > There is still debate on the matter of private methods in interfaces. > Please bring up in this forum any additional pro and con arguments that > you might have. What debate? Private methods don't get a vtbl entry so I don't see how an interface could possibly r

Re: Module-level accessibility

2010-10-04 Thread Andrei Alexandrescu
On 10/4/10 10:47 CDT, Jonathan M Davis wrote: On Monday 04 October 2010 04:41:53 Sergey wrote: Hi bearophile, you've just cheered me up :-) I'll proceed doing my best to get closer to this language. By the way, if it's not difficult for you, could you please clarify the following: 1) what did

Re: Module-level accessibility

2010-10-04 Thread Jonathan M Davis
On Monday 04 October 2010 04:41:53 Sergey wrote: > Hi bearophile, > > you've just cheered me up :-) I'll proceed doing my best to get closer to > this language. > By the way, if it's not difficult for you, could you please clarify the > following: > > 1) what did you mean by "far worse bugs" :-)

Re: Module-level accessibility

2010-10-04 Thread Sergey
Hi Daniel, I didn't by no means want to say that D is unusable or unenjoyable because of this still-persisting defect. I would say, D2 is too young to be good rather than bad. Just.. I considered D to be more mature than it currently is. Well, at any rate we need to wait some time. You sa

Re: Module-level accessibility

2010-10-04 Thread Steven Schveighoffer
On Sun, 03 Oct 2010 04:50:26 -0400, Sergey wrote: Hi, I'm a newcomer to D. Several days ago I've stumbled upon a very strange thing about D. As I understand, module members, such as classes, structs, functions and variables can be marked with an accessibility attribute, such as private,

Re: Module-level accessibility

2010-10-04 Thread Daniel Gibson
On Mon, Oct 4, 2010 at 1:24 PM, Sergey wrote: > Hi Daniel, > > I didn't by no means want to say that D is unusable or unenjoyable because > of this still-persisting defect. I would say, D2 is too young to be good > rather than bad. Just.. I considered D to be more mature than it currently > is. We

Re: Module-level accessibility

2010-10-04 Thread Don
Daniel Gibson wrote: 2010/10/4 Sergey : bearophile, thanks you very much for your answer. I've heard that D has a very vibrant community; now I know it really :) By now, from what I know about D I can draw a conclusion that it's a greatly promising language with many innovations and I would say

Re: Module-level accessibility

2010-10-04 Thread Steven Schveighoffer
On Mon, 04 Oct 2010 08:05:49 -0400, Steven Schveighoffer wrote: This has been reported several times, it looks to me like it should be fixed. What I meant was, someone should fix it, not that it's already fixed :) -Steve

Re: Module-level accessibility

2010-10-04 Thread Sergey
Hi bearophile, you've just cheered me up :-) I'll proceed doing my best to get closer to this language. By the way, if it's not difficult for you, could you please clarify the following: 1) what did you mean by "far worse bugs" :-) just several examples 2) Andrei Alexandrescu wrote in his b

Re: Module-level accessibility

2010-10-04 Thread bearophile
Sergey: > But such serious bugs that are not fixed yet can disgust any programmer, I > think. That's a mild bug :-) You can live with it, until it's fixed. There are far worse bugs in DMD now. You can't ask the implementation of a new language to be bug-free. Especially a language that has gro

Re: Module-level accessibility

2010-10-04 Thread Daniel Gibson
2010/10/4 Sergey : > bearophile, thanks you very much for your answer. I've heard that D has a > very vibrant community; now I know it really :) > > By now, from what I know about D I can draw a conclusion that it's a greatly > promising language with many innovations and I would say even fantastic

Re: Module-level accessibility

2010-10-04 Thread Sergey
bearophile, thanks you very much for your answer. I've heard that D has a very vibrant community; now I know it really :) By now, from what I know about D I can draw a conclusion that it's a greatly promising language with many innovations and I would say even fantastic features and tools (

Re: Module-level accessibility

2010-10-03 Thread bearophile
Sergey: > With a great surprise, I have discovered that from another module it is > still possible to access both x1 and C1, though fnc1() is inaccessible ! > Can anyone explain me what does it mean ? If what you have written is true, and it's easy to test it, then it just means there's anothe

Module-level accessibility

2010-10-03 Thread Sergey
Hi, I'm a newcomer to D. Several days ago I've stumbled upon a very strange thing about D. As I understand, module members, such as classes, structs, functions and variables can be marked with an accessibility attribute, such as private, public, package or export. Say, there's a module na