[Issue 23680] Support static classes in D

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 8 13:27:20 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23680

FeepingCreature <default_357-line at yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |default_357-line at yahoo.de

--- Comment #1 from FeepingCreature <default_357-line at yahoo.de> ---
Just in case you're not aware, you can do this:

```
module abc;

import std.stdio;

void print() { writeln("Hello"); }
---
module test;

static import abc;

void main() {
    abc.print;
}
```

or

```
module test;

import abc = abc;

void main() {
    abc.print;
}
```

I think `static class` should error for toplevel declarations. It has an
established meaning for nested classes: it removes the context pointer.

--


More information about the Digitalmars-d-bugs mailing list