Rust-like collect in D

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 13 03:00:56 PDT 2016


On Thursday, 13 October 2016 at 05:07:26 UTC, Russel Winder wrote:
> Java and Rust have gone the same route. collect is a terminal 
> operation creating a data structure given a potentially 
> infinite, lazily evaluated, stream.

Is D somehow better here?

For instance, we can use `if (!isInfinite!Range)` to forbid 
collecting values from an infinite `Range`. Is this checking 
done? That is

     `0.iota.make!Array`

should not be allowed.


More information about the Digitalmars-d-learn mailing list