I think this proposal is tricky because, unlike identity/1, there isn’t an obvious arity that your return function should have. Should it be:
fn -> value end
or
fn _ -> value end
or
fn _, _ -> value end
... etc
Each of those has real scenarios where they’d be useful.
The other issue is that these two things do not have the same semantics: Function.constantly(code) and fn -> code end will behave differently depending on what code is. If code is DateTime.utc_now() then Function.constantly will return the same date time over and over, but fn -> DateTime.utc_now() end will return a new datetime each time it is invoked.






















