On Friday, 2 May 2025 at 13:55:46 UTC, Orion wrote:
Yes. But at the same time, defining a function via alias is a
1st class function, unlike a standard function definition!
alias af = (int x) => x;
auto sf(int x) => x;
auto v = af;
auto p = &sf;
This means that the definitions are not equivalent.
In essence, an alias function behaves like a lambda function
assigned to a variable, but at the same time there is the
possibility of adhoc overloading, which is only possible for a
regular/standard function.
This is still a continuation of aliases are for types, enums for
literals
```d
alias F=(i)=>i+1;
import std;
void main(){
F(3).writeln;
F(3.14).writeln;
}
```
F cant be enum here, because the type inference comes latter
taking a pointer needs to be literal