version as an expression?
ryuukk_
ryuukk.dev at gmail.com
Thu Sep 8 21:15:18 UTC 2022
Currently, i am doing this,( wich sucks
```D
version(Windows)
alias socket_t = size_t;
else
alias socket_t = int;
```
I'd prefer to be able to do:
```D
alias socket_t = version(Windows) size_t else int;
```
And better, if we had pattern matching and some builtin
information available at compile time:
```D
alias socket_t = switch (builtin.target.os) {
.windows => size_t,
else => int
};
```
Why i hate the current way of doing it, but i feel it'll be
available in a distant future unfortunately:
- nothing will tell me if i forgot to implement an alias for a
target until i compile for that target
- i repeat the name of the alias N times
More information about the Digitalmars-d
mailing list