Thread overview
[Issue 13155] Disallow final abstract classes
Jul 18, 2014
Sobirari Muhomori
Jul 18, 2014
Denis Shelomovskij
Jul 19, 2014
Jonathan M Davis
Jul 19, 2014
Sobirari Muhomori
Dec 17, 2022
Iain Buclaw
July 18, 2014
https://issues.dlang.org/show_bug.cgi?id=13155

--- Comment #1 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
In C# it's not an error, but a normal idiom when a class should not be inherited and instances should not be created.

--
July 18, 2014
https://issues.dlang.org/show_bug.cgi?id=13155

--- Comment #2 from Denis Shelomovskij <verylonglogin.reg@gmail.com> ---
(In reply to Sobirari Muhomori from comment #1)
> In C# it's not an error, but a normal idiom when a class should not be inherited and instances should not be created.

1. In C# `class` can't be derived as `abstract`, it have to be explicitly marked so there is no `final class C` problem where reader may expect `C` to not be abstract.

2. In C# `class` can't be both `sealed` and `abstract` (error CS0418). Also there is `static` class syntax which ensures all class members are static and in D it's suggested to use modules with named imports for this purpose. Note: `static` classes are implemented as `abstract sealed` on IL level, but it's not visible for the user and is just a workaround for languages without support for static classes.

--
July 19, 2014
https://issues.dlang.org/show_bug.cgi?id=13155

Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com

--- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> ---
I very much doubt that this will ever happen. It's used at least one place in Phobos (std.process.environment). Basically, it allows you to create a namespace within a module or to have a global singleton of sorts. You can do something similar by declaring a class whose default constructor is disabled, but regardless, some people are definitely using final abstract (or abstract final) on purpose, so I don't expect that it will ever become illegal.

--
July 19, 2014
https://issues.dlang.org/show_bug.cgi?id=13155

--- Comment #4 from Sobirari Muhomori <dfj1esp02@sneakemail.com> ---
Implementing final abstract as modules may be not an option, example: GCAllocator, which has only static members, but still has to be a single entity with a certain API - an allocator.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=13155

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 13
https://issues.dlang.org/show_bug.cgi?id=13155

--- Comment #5 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18851

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--