alias vs enum for lambdas?
Orion
vlad000ff at yopmail.com
Fri May 2 13:55:46 UTC 2025
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.
More information about the Digitalmars-d-learn
mailing list