[Issue 2946] Make 'abstract' mandatory if the class is intended to be abstract

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 21 05:27:55 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=2946


Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |


--- Comment #9 from Stewart Gordon <smjg at iname.com> 2013-01-21 05:27:53 PST ---
(In reply to comment #8)
> I don't think this will fly.

It's up to Walter whether this will be implemented.

> Abstract on the class name itself makes it non-instantiable, 
> however subclasses are not abstract and can be instantiated:

It isn't clear to me what relevance this has.  The point of this request is to
require abstract classes to be declared as abstract.  You're talking about
classes that already are declared as abstract.

> Whether or not there's an abstract keyword next to the class name 
> doesn't tell you whether the class actually has abstract methods, 
> so there's no benefit forcing you to add 'abstract' to the name.

It isn't supposed to tell you whether it has abstract methods.  It's supposed
to tell you whether the class is abstract, i.e. barred from direct
instantiation.

With the abstract attribute being optional on the class declaration itself, one
has to look through all the methods to determine whether the class is abstract
or not.  With it being mandatory, the information is right in front of you when
you look at the class.

It would also be useful for documentation generators.  Whether a class has any
abstract methods depends not only on methods declared directly within the body
of the class, but also on those in superclasses of the class, interfaces the
class implements, and method declarations generated by mixins.  The last of
these effectively means that no standalone documentation generator (unless it
contains a full D conditional compilation and CTFE engine) can correctly
indicate which classes are abstract and which aren't.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list