More operators inside `is(...)` expressions
Stefan Koch
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
wrote:
> 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
>>> `is(...)`-expressions?
>>>
>>> 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.
>
> -Steve
True, though how is pattern matching going to work if you allow
!= ?
More information about the Digitalmars-d
mailing list