[Issue 2946] Make 'abstract' mandatory if the class is intended to be abstract
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 18 04:08:07 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=2946
Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |verylonglogin.reg at gmail.com
--- Comment #13 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
1. Currently `abstract` in required if not all `interface` methods are
implemented or overridden with an `abstract` method:
---
interface I { void f(); }
abstract class CI1: I { } // `abstract` required
abstract class CI2: CI1 { } // `abstract` required too
class B { abstract void f(); }
class CB: B { } // derived as `abstract`
class CI3: I { abstract void f(); }
class CI4: CI3 { } // derived as `abstract` too
---
This difference looks inconsistent.
2. When one sees a class `C` and want to understand whether or not it is
abstract he has to look through every ancestor of `C` to determine whether it
contains an `abstract` method unimplemented further. And it's really hard. IMO
it would be much better if class declaration clearly shows whether it's
abstract or not.
3. Currently a compiler prints what methods are unimplemented if one tries to
create an abstract class instance so this isn't a critical issue, just a bad
looking thing in a language (IMHO).
--
More information about the Digitalmars-d-bugs
mailing list