On 07/09/2012 10:46 PM, bearophile wrote:
Jacob Carlborg:
import std.algorithm;
import std.range;
struct Foo {}
auto f = Foo();
auto foos = [f];
auto foo = foos.map!(x => "foo");
auto bar = foo.chain("bar");
I suggest to always compile with "-wi -property".
Both -property and -w/-wi are broken and their only merit so far is to
break my builds for no reason.
-wi spits out about 4000 lines of false (duplicate) warnings when run
against my code base.
This simple example result in the follow error:
http://pastebin.com/E4LV2UBE
Another example:
auto str = ["foo", "bar"].map!(x => x);
auto f = str.sort();
Map returns a lazy iterable. Generally you need an eager
random-access iterable to sort (but it seems there are some
exceptions like when you sort a zip...).
Actually you need a random-access range with assignable elements. Map
would need to be provided with an inverse mapping to support that.
zip has assignable elements when the source ranges do.