digitalmars.D.bugs - Polymorphism broken by 'package' visibility
- Kris (26/26) May 19 2005 class Base
- Thomas Kuehne (12/38) May 20 2005 -----BEGIN PGP SIGNED MESSAGE-----
- Walter (2/4) May 20 2005 This is as designed - 'private' and 'package' functions are not virtual.
- Kris (6/10) May 20 2005 Thanks for the clarification.
- Ant (16/19) May 20 2005 what happened Kris?
- =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= (22/22) May 21 2005 -----BEGIN PGP SIGNED MESSAGE-----
class Base { package char[] name () { return "base"; } char[] test () { return name(); } } class Derived : Base { package override char[] name() { return "derived"; } } void main() { Derived d = new Derived; // fails! assert (d.test() == "derived"); } Derived.test() returns "base" instead of "derived" ... works as expected with 'protected' etc.
May 19 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kris schrieb am Thu, 19 May 2005 17:21:59 -0700:class Base { package char[] name () { return "base"; } char[] test () { return name(); } } class Derived : Base { package override char[] name() { return "derived"; } } void main() { Derived d = new Derived; // fails! assert (d.test() == "derived"); } Derived.test() returns "base" instead of "derived" ... works as expected with 'protected' etc.Added to DStress as http://dstress.kuehne.cn/run/o/overload_23.d http://dstress.kuehne.cn/run/o/overload_24.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCjdI33w+/yD4P9tIRAlZRAJoDgHjplaFgdrcS2hl+Im4d8aq/xQCeL/i2 hyLWrLWVSuOUmtplg0qhR0M= =Lxge -----END PGP SIGNATURE-----
May 20 2005
"Kris" <fu bar.com> wrote in message news:d6jaj8$2r1n$1 digitaldaemon.com...Derived.test() returns "base" instead of "derived" ... works as expected with 'protected' etc.This is as designed - 'private' and 'package' functions are not virtual.
May 20 2005
Thanks for the clarification. Private, sure. Package? That's a tad unexpected. I guess I must have missed that in the documentation? "Walter" <newshound digitalmars.com> wrote in message news:d6lgva$1kd0$1 digitaldaemon.com..."Kris" <fu bar.com> wrote in messagenews:d6jaj8$2r1n$1 digitaldaemon.com...Derived.test() returns "base" instead of "derived" ... works as expected with 'protected' etc.This is as designed - 'private' and 'package' functions are not virtual.
May 20 2005
Kris wrote:Thanks for the clarification. Private, sure. Package? That's a tad unexpected.what happened Kris? lost your fire? ;) It's absurd! :( well, not as bad as: - default on switch (even Walter was caught on this I'm surprised nobody referred it) - missing return - == null - legacy "compatibilities" (case, ~this(), cast...) - stupid name resolution rules - ... :p See Walter? D is so good that we even put up with these things! but somehow I always feel like "almost there..." :( Ant PS Kris, we are all expecting a 4 pages PDF...
May 20 2005
Ant wrote:Kris wrote:Hello, Ant ~ Long time!Thanks for the clarification. Private, sure. Package? That's a tad unexpected.what happened Kris? lost your fire? ;)Hell, no. I was just waiting for you <g>It's absurd! :(I'd really like to hear why it /should/ be like it is ... anyone? <snip>PS Kris, we are all expecting a 4 pages PDF...Better things to do; such as teaching this octopus to waltz, on just two legs :)
May 21 2005
lol "Ant" <duitoolkit yahoo.ca> wrote in message news:d6mj4f$2bdp$1 digitaldaemon.com...Kris wrote:referred it)Thanks for the clarification. Private, sure. Package? That's a tad unexpected.what happened Kris? lost your fire? ;) It's absurd! :( well, not as bad as: - default on switch (even Walter was caught on this I'm surprised nobody- missing return - == null - legacy "compatibilities" (case, ~this(), cast...) - stupid name resolution rules - ... :p See Walter? D is so good that we even put up with these things! but somehow I always feel like "almost there..." :( Ant PS Kris, we are all expecting a 4 pages PDF...
May 23 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Walter wrote: | "Kris" <fu bar.com> wrote in message | news:d6jaj8$2r1n$1 digitaldaemon.com... | |> Derived.test() returns "base" instead of "derived" ... works as |> expected with 'protected' etc. | | | This is as designed - 'private' and 'package' functions are not | virtual. | http://digitalmars.com/d/function.html All non-static non-private member functions are virtual. Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (MingW32) iD8DBQFCj4b83w+/yD4P9tIRAtCWAJ4hh+pZ3zPFsFgz6LW26Fo3W41RfACeIry/ rjcI1UFD/Yjaim0tUBa8Y3o= =J6+2 -----END PGP SIGNATURE-----
May 21 2005