Re: private method in interface

2011-06-04 Thread Jacob Carlborg
On 2011-06-03 23:55, Michael Shulman wrote: On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis wrote: And if you don't know about NVI, having a virtual private function is just plain weird. Well, it makes perfect sense to me, once given that in D, 'private' allows access from anywhere in the sa

Re: private method in interface

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 21:52, Michael Shulman wrote: > On Fri, Jun 3, 2011 at 8:54 PM, Jonathan M Davis wrote: > > Try to compile with -w. My guess is that you will get a compiler error. > > Nope. Then file a bug report on it. As I understand it, overriding a non-virtual function in D should be illegal

Re: private method in interface

2011-06-03 Thread Michael Shulman
On Fri, Jun 3, 2011 at 8:54 PM, Jonathan M Davis wrote: > Try to compile with -w. My guess is that you will get a compiler error. Nope.

Re: private method in interface

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 19:44, Michael Shulman wrote: > On Fri, Jun 3, 2011 at 3:07 PM, Jonathan M Davis wrote: > > I'd suggest opening a bug report. > > Okay, will do. > > > Regardless, I would have hoped that you'd get an error at compile > > time about overriding a non-virtual function if package is >

Re: private method in interface

2011-06-03 Thread Michael Shulman
The bug report appears to already exist: http://d.puremagic.com/issues/show_bug.cgi?id=3258 On Fri, Jun 3, 2011 at 3:07 PM, Jonathan M Davis wrote: > On 2011-06-03 14:55, Michael Shulman wrote: >> On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis > wrote: >> > And if you don't know about NVI, hav

Re: private method in interface

2011-06-03 Thread Michael Shulman
On Fri, Jun 3, 2011 at 3:07 PM, Jonathan M Davis wrote: > I'd suggest opening a bug report. Okay, will do. > Regardless, I would have hoped that you'd get an error at compile > time about overriding a non-virtual function if package is > non-virtual It appears that overriding a non-virtual, non

Re: private method in interface

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 14:55, Michael Shulman wrote: > On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis wrote: > > And if you don't know about NVI, having a > > virtual private function is just plain weird. > > Well, it makes perfect sense to me, once given that in D, 'private' > allows access from anywh

Re: private method in interface

2011-06-03 Thread Michael Shulman
On Fri, Jun 3, 2011 at 1:02 PM, Jonathan M Davis wrote: > And if you don't know about NVI, having a > virtual private function is just plain weird. Well, it makes perfect sense to me, once given that in D, 'private' allows access from anywhere in the same module, rather than only in the defining

Re: private method in interface

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 11:59, Michael Shulman wrote: > On Fri, Jun 3, 2011 at 11:22 AM, Jonathan M Davis wrote: > >> However, given that in D, 'private' only means restricted to a > >> *module*, it's less clear to me why private functions should be > >> singled out as non-virtual. I might want certain met

Re: private method in interface

2011-06-03 Thread Michael Shulman
On Fri, Jun 3, 2011 at 11:22 AM, Jonathan M Davis wrote: >> However, given that in D, 'private' only means restricted to a >> *module*, it's less clear to me why private functions should be >> singled out as non-virtual. I might want certain methods to be >> accessible only within a given module,

Re: private method in interface

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 11:13, Michael Shulman wrote: > On Thu, Jun 2, 2011 at 11:55 PM, Jonathan M Davis wrote: > > I don't really like the idea of private functions being virtual > > by default though, so maybe your suggestion would be a good one. > > Speaking as a newbie with very little D experience,

Re: private method in interface

2011-06-03 Thread Michael Shulman
On Thu, Jun 2, 2011 at 11:55 PM, Jonathan M Davis wrote: > I don't really like the idea of private functions being virtual > by default though, so maybe your suggestion would be a good one. Speaking as a newbie with very little D experience, the idea of private functions being non-virtual would m

Re: private method in interface

2011-06-02 Thread Jonathan M Davis
On 2011-06-02 23:53, Kagamin wrote: > Jonathan M Davis Wrote: > > http://d.puremagic.com/issues/show_bug.cgi?id=4542 > > http://d.puremagic.com/issues/show_bug.cgi?id=2051 > > Nothing prevents compiler from considering class private methods as final > and allow implement interface private methods

Re: private method in interface

2011-06-02 Thread Kagamin
Jonathan M Davis Wrote: > http://d.puremagic.com/issues/show_bug.cgi?id=4542 > http://d.puremagic.com/issues/show_bug.cgi?id=2051 Nothing prevents compiler from considering class private methods as final and allow implement interface private methods (possibly with requirement for `override` key

Re: private method in interface

2011-06-02 Thread Michael Shulman
Thanks! On Thu, Jun 2, 2011 at 2:36 PM, Jonathan M Davis wrote: > On 2011-06-02 12:59, Michael Shulman wrote: >> On Thu, Jun 2, 2011 at 12:20 PM, Jonathan M Davis > wrote: >> > http://d.puremagic.com/issues/show_bug.cgi?id=4542 >> > http://d.puremagic.com/issues/show_bug.cgi?id=2051 >> >> Thank

Re: private method in interface

2011-06-02 Thread Jonathan M Davis
On 2011-06-02 12:59, Michael Shulman wrote: > On Thu, Jun 2, 2011 at 12:20 PM, Jonathan M Davis wrote: > > http://d.puremagic.com/issues/show_bug.cgi?id=4542 > > http://d.puremagic.com/issues/show_bug.cgi?id=2051 > > Thank you! I think this answers my question completely; I just need > to change

Re: private method in interface

2011-06-02 Thread Michael Shulman
On Thu, Jun 2, 2011 at 12:20 PM, Jonathan M Davis wrote: > http://d.puremagic.com/issues/show_bug.cgi?id=4542 > http://d.puremagic.com/issues/show_bug.cgi?id=2051 Thank you! I think this answers my question completely; I just need to change "private" to "protected". Is there a place on the web

Re: private method in interface

2011-06-02 Thread Jonathan M Davis
On 2011-06-02 12:01, Michael Shulman wrote: > On Thu, Jun 2, 2011 at 10:31 AM, Steven Schveighoffer > > wrote: > > Private methods are non-virtual, so I'm pretty sure they are not supposed > > to be allowed in an interface. > > > > But I suppose private could also mean private final, in which ca

Re: private method in interface

2011-06-02 Thread Steven Schveighoffer
On Thu, 02 Jun 2011 15:01:31 -0400, Michael Shulman wrote: On Thu, Jun 2, 2011 at 10:31 AM, Steven Schveighoffer wrote: Private methods are non-virtual, so I'm pretty sure they are not supposed to be allowed in an interface. But I suppose private could also mean private final, in which c

Re: private method in interface

2011-06-02 Thread Michael Shulman
On Thu, Jun 2, 2011 at 10:31 AM, Steven Schveighoffer wrote: > Private methods are non-virtual, so I'm pretty sure they are not supposed to > be allowed in an interface. > > But I suppose private could also mean private final, in which case you have > to provide an implementation for foo in the in

Re: private method in interface

2011-06-02 Thread Steven Schveighoffer
On Thu, 02 Jun 2011 13:10:14 -0400, Michael Shulman wrote: Hi, The following code fails the linker, complaining about an undefined reference to 'foo': interface A { private int foo(); } class B { int bar(A x) { return x.foo(); } } void main() { } But if I remove the 'private' quali