Phobos PR: `call` vs. `bindTo`
Idan Arye via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 5 15:17:54 PDT 2014
On Tuesday, 5 August 2014 at 21:10:25 UTC, Tofu Ninja wrote:
> Can you explain the utility of both of them? I am not big into
> functional programming so I am not seeing it.
The purpose of `bindTo` is to emulate the `let` expressions found
in many functional languages (see
http://en.wikipedia.org/wiki/Let_expression). The idea is to bind
a value to a name for the limited scope of a single expression.
Note that `bindTo` could be implemented as:
alias bindTo = std.functional.unaryFun;
and I'll probably change the implementation to this if this PR
will be chosen. The reason I think `bindTo` is needed even if
it's just an alias to `unaryFun` is that `bindTo` conveys better
that the you are binding a name to a value, not just
overcomplicating the code.
More information about the Digitalmars-d
mailing list