Do classes require explicit constructors?

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sat Feb 14 16:08:15 UTC 2026


On 15/02/2026 4:57 AM, Mike Parker wrote:
> On Saturday, 14 February 2026 at 15:54:23 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
> 
>>
>>>> They are massive pain for exceptions.
>>>
>>> Why are they a massive pain?  Please explain.
>>
>> You have to manually write the constructors for every exception you 
>> want to declare yourself.
>>
>> Normally with IDE's you'd have assistance and it would be done 
>> automatically, but that isn't normal for D.
>>
>> There are multiple parameters. Not a joy.
> 
> How many exception constructors do you write?

Zero, because I absolutely hate doing it.

Same reason why I avoid class hierarchies like the plague.

There are some real irritants with it that don't need to exist.

> Minor annoyance, maybe, 
> but massive pain? Really?

To me yes.

 From Java, the experience was a total 180.

I went from yeah ok I need this exception, go declare it.
To let's just throw an Exception forget about doing this properly.

It breeds slop, which really grates on me.

Usually I can get away with ignoring these features, but with PhobosV3 I 
am unable to. I've already had to add new exception classes to druntime 
specifically for it as part of null check.

I want classes improved, there is plenty of room for it.



More information about the Digitalmars-d-learn mailing list