On Thursday, 8 April 2021 at 22:27:38 UTC, Alain De Vos wrote:
>So which concrete types do you give for the two auto's.
The first auto
is the return type of to!(ubyte[])
--so, it's ubyte[]
.
The second auto
is the return type of map
. If you look at the documentation [2], you'll see that it doesn't give a concrete type for the return value; it just says that map
returns "an input range." That's because the concrete type is a so-called "Voldemort type" [1]--a type whose name is private to the function, and can't be used externally.
Why use such a type? Because it gives the authors of map
the freedom to change the concrete type without breaking code that uses map
, as long as the type they change it to still supports the input range interface.
[1] https://wiki.dlang.org/Voldemort_types
[2] https://phobos.dpldocs.info/std.algorithm.iteration.map.map.html