No need for version expression is a lie
ryuukk_
ryuukk.dev at gmail.com
Tue Aug 22 22:03:41 UTC 2023
Since i got confused with ``version(linux)`` and
``version(Linux)``, i try to limit my use of that kind of code to
a strict minimum.. but sometimes it just is not possible to avoid
using it
I wish it was represented as an enum, similar to how compiler do
the ``__FILE__``
But for that to work, D would need to support .enum so you
wouldn't need to import anything
In D that would look like:
```D
enum STUFF = static switch(__OS__) {
case OS.Linux:
break;
default:
break;
};
```
In a sane language that would look like:
```D
enum STUFF = switch(__OS__) {
.Linux => (..);
else => (..);
};
```
Funny enough i requested something similar months ago
https://forum.dlang.org/thread/bnwbsqsyvcyhjublipxk@forum.dlang.org
The reason why people don't understand the motive is because they
can't conceptualize a better syntax yet and think the C's way of
doing switch is the immutable status quo, i nulify it because i
have choice, nowadays people have choice
tagged union, tuples, .enum, pattern matching, essential features
in a post C world
More information about the Digitalmars-d
mailing list