On 15/02/2026 4:50 AM, Brother Bill wrote:
On Saturday, 14 February 2026 at 15:45:20 UTC, Richard (Rikki) Andrew Cattermole wrote:
On 15/02/2026 4:42 AM, Brother Bill wrote:
Is this expected behavior, that is, we always need to create our constructors, no free constructor is built for us by the D compiler?

Yes currently.

If so, this is a clear departure from C# and Eiffel, where one gets a free constructor if no explicitly declared constructors.

D's classes were based off of Java's.

I want some changes to them, constructors also don't inherit.

Eiffel may be the only language that supports inheriting constructers.
In Eiffel, a constructor is just another method, that is marked as a constructor in "create" clause.  As all methods are inheritable by default in Eiffel, constructors can be inherited there.

Swift does it too.

There is a bunch of "fun" rules surrounding it though.

I think we can simplify it right down though.

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.

  • Do classes requi... Brother Bill via Digitalmars-d-learn
    • Re: Do clas... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: Do ... Brother Bill via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... Mike Parker via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Brother Bill via Digitalmars-d-learn
                • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
            • ... Mindy (0xEAB) via Digitalmars-d-learn
              • ... Mindy (0xEAB) via Digitalmars-d-learn
        • Re:... Andy Valencia via Digitalmars-d-learn
    • Re: Do clas... Steven Schveighoffer via Digitalmars-d-learn

Reply via email to