More operators inside `is(...)` expressions
uplink.coder at googlemail.com
Sun Aug 23 21:51:09 UTC 2020
On Sunday, 23 August 2020 at 21:20:21 UTC, Steven Schveighoffer
> On 8/23/20 5:12 PM, Stefan Koch wrote:
>> On Sunday, 23 August 2020 at 21:08:30 UTC, Per Nordlöw wrote:
>>> Why aren't more operators allowed inside
>>> For instance
>>> if (!is(CommonType!(typeof(min), typeof(max)) == void))
>>> could be written as
>>> if (is(CommonType!(typeof(min), typeof(max)) != void))
> I agree. There's a reason we have != and don't require people
> to write !(x == y)
>> Because you don't want to make them even more complicated than
>> they are already.
> This one though is really annoying. I've bristled at that a few
> times when I had to write it.
> What is the cost here? Just use the same AST node for the is
> expression, and wrap it in a `not` AST node.
True, though how is pattern matching going to work if you allow
More information about the Digitalmars-d