using the full range of ubyte with iota

Dominikus Dittes Scherkl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 24 16:12:18 PST 2015


On Saturday, 24 January 2015 at 23:19:11 UTC, ketmar wrote:
> people that are new to D aren't used to D lambdas, so it's 
> fairly common.
Oh, I am aware, but I didn't thought it would be necessary in 
this pace.

> if you'll stay with D, you'll find yourself dreaming about such 
> handy thing in another compiled languages very soon. ;-)

I don't consider to use any other language as long as I have a 
choice :-)

But in the end, my one short and beautiful solution

auto myRange = iota(start, end).map!foo;

changed into something quite klumsy:

auto myRange = iota(start, end).map!(x => 
foo(cast(ParameterTypeTuple!foo[0])x));

which I think is against the philosophy of D as it turns away the 
eye of the reader from what is really going on, especially if 
previous constraints ensured that start and end-1 are of the 
correct type :-(

But ok, still far, far better than what would be neccessary in C++


More information about the Digitalmars-d-learn mailing list