Pattern matching is-expressions

Dennis dkorpel at gmail.com
Wed Aug 19 11:56:18 UTC 2020


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.

> // 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.


More information about the Digitalmars-d mailing list