Thread overview
[Issue 23680] Support static classes in D
Feb 08, 2023
FeepingCreature
Feb 27, 2023
Iain Buclaw
February 08, 2023
https://issues.dlang.org/show_bug.cgi?id=23680

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

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

--- Comment #1 from FeepingCreature <default_357-line@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.

--
February 08, 2023
https://issues.dlang.org/show_bug.cgi?id=23680

--- Comment #2 from Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> ---
Yea I'm aware but this is really not intuitive for beginners. Plus, there's no way to do that using a single file. Like, it's not really me, but People.Like.Doing.That.Way, always uppercase, specially from people coming from Java which they directly imported a class.

Yea `static class` has no meaning for top level, so, for me, the solution to that is giving it a meaning by or implementing the static class functionality from other languages or giving it an error.

--
February 27, 2023
https://issues.dlang.org/show_bug.cgi?id=23680

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--