More operators inside `is(...)` expressions
Ogi
ogion.art at gmail.com
Fri Aug 28 07:22:51 UTC 2020
On Sunday, 23 August 2020 at 21:08:30 UTC, Per Nordlöw wrote:
> Why aren't more operators allowed inside `is(...)`-expressions?
>
> For instance
>
> if (!is(CommonType!(typeof(min), typeof(max)) == void))
>
> could be written as
>
> if (is(CommonType!(typeof(min), typeof(max)) != void))
>
> .
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.
More information about the Digitalmars-d
mailing list