shouldn't override be obligatory?

2010-03-13 Thread Trass3r
so you don't accidentally override a base class method without knowing it.

Re: shouldn't override be obligatory?

2010-03-13 Thread bearophile
Trass3r: > so you don't accidentally override a base class method without knowing it. I'm trying to help D become tidier, I have added this days ago: http://d.puremagic.com/issues/show_bug.cgi?id=3836 Bye, bearophile

Re: shouldn't override be obligatory?

2010-03-13 Thread Nick Sabalausky
"Trass3r" wrote in message news:op.u9i1zxqa3nc...@hoenir.fem.tu-ilmenau.de... > so you don't accidentally override a base class method without knowing it. I read about "override" when I first got into D way back before D1.0 and thought it sounded great. Then I promptly forgot about it since the

Re: shouldn't override be obligatory?

2010-03-13 Thread Nick Sabalausky
"Nick Sabalausky" wrote in message news:hnh4kl$1iq...@digitalmars.com... > "Trass3r" wrote in message > news:op.u9i1zxqa3nc...@hoenir.fem.tu-ilmenau.de... >> so you don't accidentally override a base class method without knowing >> it. > > I read about "override" when I first got into D way ba

Re: shouldn't override be obligatory?

2010-03-13 Thread Michel Fortin
On 2010-03-13 17:27:23 -0500, Trass3r said: so you don't accidentally override a base class method without knowing it. It's my opinion that it should. (bugzilla 3836)++ -- Michel Fortin michel.for...@michelf.com http://michelf.com/

Re: shouldn't override be obligatory?

2010-03-13 Thread Andrei Alexandrescu
On 03/13/2010 04:27 PM, Trass3r wrote: so you don't accidentally override a base class method without knowing it. It is in TDPL so it is in the language :o). Andrei

Re: shouldn't override be obligatory?

2010-03-14 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Trass3r wrote: > so you don't accidentally override a base class method without knowing it. use -w: import std.stdio; class A { void foo() { writeln("A.foo"); } } class B : A { void foo() { writeln("B.foo"); } } void main() { A a = new

Re: shouldn't override be obligatory?

2010-03-14 Thread Jonathan M Davis
div0 wrote: > Strangely it doesn't give an error if A is an interface though. Interfaces aren't overridden; they're implemented. You're providing functionality, not replacing it. By marking a function with override, you're clearly marking that it's polymorphic and intended to be so. If you forc

Re: shouldn't override be obligatory?

2010-03-15 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan M Davis wrote: > div0 wrote: > >> Strangely it doesn't give an error if A is an interface though. > > Interfaces aren't overridden; they're implemented. You're providing > functionality, not replacing it. By marking a function with override

Re: shouldn't override be obligatory?

2010-03-15 Thread Trass3r
True, but using override clearly documents what you doing in that class. Otherwise you have to arse about looking through the interfaces to see if an unmarked function is an implementation, which is the same end result as unmarked overrides. I vote for requiring override in all cases; I think it

Re: shouldn't override be obligatory?

2010-03-15 Thread Jonathan M Davis
div0 wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Jonathan M Davis wrote: >> div0 wrote: >> >>> Strangely it doesn't give an error if A is an interface though. >> >> Interfaces aren't overridden; they're implemented. You're providing >> functionality, not replacing it. By markin