DIP proposal: Enum parameters
Quirin Schroll
qs.il.paperinik at gmail.com
Mon Sep 26 11:23:58 UTC 2022
On Saturday, 24 September 2022 at 07:51:32 UTC, Imperatorn wrote:
> I'm a bit torn about `static` vs `enum`. I partly agree with
> prior speakers about `enum` getting too many meanings, but on
> the other hand, it's not really a problem imo.
One biggie against using `static` is that on member functions it
would have to go to the back (where it is currently invalid) with
a totally different meaning than in front (although it would make
the function a static).
Non-member:
```d
void f()(static int ctValue) { } // this is fine
```
Member:
```d
struct S
{
void f()() static { } // different from:
static void g()() { }
void p()() enum { } // same as
enum void q()() { }
}
```
This would be no problem if D did not allow putting some stuff
before and after the function declaration with the same meaning.
I really dislike `void f()() static { }`.
Currently, `enum` is valid for member functions like `q`, but
does nothing. That would change, but I’d bet that almost no one
has this in their code base anyway, so breakage would be minimal.
More information about the Digitalmars-d
mailing list