alias vs enum for lambdas?

Nick Treleaven nick at geany.org
Sat May 3 11:04:33 UTC 2025


On Friday, 2 May 2025 at 16:53:05 UTC, monkyyy wrote:
> This is still a continuation of aliases are for types, enums 
> for literals
>
> ```d
> alias F=(i)=>i+1;

```d
pragma(msg, is(F)); // false, F is not a type
```
Even if we give `i` a type:

```d
alias F=(int i)=>i+1;
pragma(msg, is(F)); // still false
```

And F is clearly bound to a literal - a function literal.


More information about the Digitalmars-d-learn mailing list