More operators inside `is(...)` expressions
Jacob Carlborg
doob at me.com
Fri Aug 28 12:45:24 UTC 2020
On Friday, 28 August 2020 at 07:22:51 UTC, Ogi wrote:
> There is one expression where allowing “!” would be much more
> beneficial — version condition. Currently we are forced to
> write something like:
> version (OSX) {} else {
> /* ... */
> }
> when it could be just:
> version (!OSX) {
> /* ... */
> }
> I am aware that it was Walter’s intention to make the version
> syntax simplistic, but I don’t think that allowing “!” would do
> any harm.
There's a workaround: define bool enums for all version
identifiers and use `static if` instead:
version (OSX)
enum OSX = true;
else
enum OSX = false;
static if (!OSX) {}
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list