On Monday, 6 May 2024 at 17:55:49 UTC, user1234 wrote:
I think this just works:

```d
enum Flag : bool
{
    no,
    yes
}

alias AllowVancancy = Flag; // example usage
```

```d
import std.stdio : writeln;

enum Flag : bool { no, yes }
alias Traditional = Flag;
alias Color = Flag;

void hello(Traditional traditional, Color color) {
    if (traditional && color) {
        writeln("\x1b[31;1mhello world\x1b[0m");
    } else if (traditional && !color) {
        writeln("hello world");
    } else if (!traditional && color) {
        writeln("\x1b[31;1mHello, world!\x1b[0m");
    } else {
        writeln("Hello, world!");
    }
}

void main() {
hello(Color.yes, Traditional.yes); // this is wrong, but accepted
}
```

Reply via email to