3 ms·
> But Erlang itself, as a language, doesn't even have function-reference literals; you usually just pass {FunctionName, Arity} tuples around. I don't really un
by toast0 2y ago
> But Erlang itself, as a language, doesn't even have function-reference literals; you usually just pass {FunctionName, Arity} tuples around.
I don't really understand what a literal is, but isn't fun erlang:node/0 a literal? It operates the same way as 1, which I'm quite sure is a numeric literal:
Eshell V12.3.2.17 (abort with ^G)
1> F = fun erlang:node/0.
fun erlang:node/0
2> X = 1.
1
3> F.
fun erlang:node/0
4> X.
1
I set the variable to the thing, and then when I output the variable, I see the same value I set. AFAIK, both 1 and fun erlang:node/0 must both be literals, as they behave the same; but I'm happy to learn otherwise.
- derefr 2y agoYou're right! Edited. (I think I never wrote Erlang for long enough before switching to Elixir to find this syntax. Also, I don't think it's ever come up in any Erlang code I've read. It's kind of obscure!)