On Sunday, 5 February 2023 at 22:40:09 UTC, ProtectAndHide wrote:

..


module test;

import std;

static final class Algo
{
    @disable this();

    static this()
    {
        Message =  "Hello!";
    }

    static:

    string Message;

    void drawLine() {};
}

void main()
{
Algo foo1 = null; // the compiler should not allow you to declare a variable of static type Algo[] foo2 = null; // the compiler should not allow you to declare an array with elements of static type List[Algo] foo3; // the compiler should not allow you to use static types as type arguments

    writeln(foo1);
    writeln(foo2);
    writeln(foo3);
}

void Method1(Algo x) {} // the compiler should not allow you to use static types as parameters

Algo Method2() { return null; } // the compiler should not allow you to use static types as return types

struct List {}



  • Re: Non-ugly way... Nick Treleaven via Digitalmars-d-learn
    • Re: Non-ugl... thebluepandabear via Digitalmars-d-learn
      • Re: Non... thebluepandabear via Digitalmars-d-learn
        • Re:... ProtectAndHide via Digitalmars-d-learn
          • ... thebluepandabear via Digitalmars-d-learn
            • ... thebluepandabear via Digitalmars-d-learn
              • ... Ali Çehreli via Digitalmars-d-learn
              • ... thebluepandabear via Digitalmars-d-learn
            • ... ProtectAndHide via Digitalmars-d-learn
              • ... ProtectAndHide via Digitalmars-d-learn
              • ... Ali Çehreli via Digitalmars-d-learn
              • ... thebluepandabear via Digitalmars-d-learn
              • ... Ali Çehreli via Digitalmars-d-learn
              • ... ProtectAndHide via Digitalmars-d-learn
              • ... thebluepandabear via Digitalmars-d-learn
              • ... Ali Çehreli via Digitalmars-d-learn
              • ... ProtectAndHide via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... ProtectAndHide via Digitalmars-d-learn
              • ... Ali Çehreli via Digitalmars-d-learn

Reply via email to