Pattern matching is-expressions

Stefan Koch uplink.coder at googlemail.com
Wed Aug 19 12:03:59 UTC 2020


On Wednesday, 19 August 2020 at 11:56:18 UTC, Dennis wrote:
> On Wednesday, 19 August 2020 at 09:53:41 UTC, Stefan Koch wrote:
>>     		pragma(msg, is(typeof(invert) == void 
>> function(double[]))); // false ???
>
> The `function` keyword represents a function pointer, while 
> invert is a function.
> Change it to `typeof(&invert)` and it will hold true.
>
Thanks!

>> // what we see here is that is expressions are broken.
>> // pragma(msg, is(typeof(invert) == R F (A), R, A, F)); // if 
>> it's not a function let F be a free symbol as well
>
> is expression were never specified to match arbitrary patterns, 
> so I wouldn't call it inconsistent or broken, just limited.

Let's call it limited then.

Does a limited pattern matching still fulfill a desirable power 
to complexity ratio though?


More information about the Digitalmars-d mailing list