On Wednesday, 21 March 2018 at 19:41:39 UTC, H. S. Teoh wrote:
        version(all) { ... }
        version(none) { ... }
        version(Posix) { ... }
        version(Windows) { ... }

But yeah, using "version" for this purpose makes the very common identifier "version" unavailable for use. I've been bitten by this multiple times.

        auto version = getVersion();    // NG
        auto ver = getVersion();        // OK

        struct PacketHeader {
                ushort version;         // NG
                ushort ver;             // OK
        }

C code also uses `in`, `out` and `with` as identifiers.

I think, with some funny escape sequences we can do without any keyword at all:
        \1(all) { ... }
        \1(none) { ... }
        \1(Posix) { ... }
        \1(Windows) { ... }
        \5 version = getVersion();
        \2 PacketHeader {
                \6 version;
        }

Reply via email to