Phobos PR: `call` vs. `bindTo`

Idan Arye via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 6 12:47:31 PDT 2014


On Tuesday, 5 August 2014 at 23:25:40 UTC, Artur Skawina via 
Digitalmars-d wrote:
> On 08/05/14 21:29, H. S. Teoh via Digitalmars-d wrote:
>> There are currently two Phobos PR's that implement essentially 
>> the same
>> functionality, but in slightly different ways:
>> 
>> 	https://github.com/D-Programming-Language/phobos/pull/1255
>
> How is
>
>    (1 + 2 * 3).bindTo!(x => x * x * x + 2 * x * x + 3 * x)()
>
> better than
>
>    (x => x * x * x + 2 * x * x + 3 * x)(1 + 2 * 3)
>
> ?
>
> artur

In the second version, the value `1 + 2 * 3` and the name `x` are 
far away from each other, on the opposite sides of the big 
expression. This makes it harder to see the connection between 
them.


More information about the Digitalmars-d mailing list