[Issue 8882] map, filter, iota and zip in pure (and nothrow) functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 30 01:03:11 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=8882

--- Comment #10 from ZombineDev <petar.p.kirov at gmail.com> ---
(In reply to RazvanN from comment #9)
> (In reply to ZombineDev from comment #8)
> > While, the OP code compiles, zip is not yet nothrow. See:
> > 
> > ```
> > import std.algorithm: map, filter;
> > import std.range: iota, zip, array;
> > import std.typecons : tuple;
> > 
> > auto get() pure nothrow
> > {    
> >     auto m = map!q{a * a}([1, 2, 3]);
> >     auto f = filter!q{ a > 1 }([1, 2, 3]);
> >     auto i = iota(1, 10, 2);
> >     auto z = zip([1, 2, 3], [10, 20, 30]);
> >     return tuple(m.array, f.array, i.array, z.array);
> > }
> > 
> > void main()
> > {        
> >     import std.stdio;
> >     writeln(get());
> > }
> > ```
> > 
> > test.d(11): Error: function std.array.array!(Zip!(int[], int[])).array is
> > not nothrow
> > test.d(4): Error: nothrow function test.get may throw
> 
> There already is issue 11466 [1] which addresses problem, so I suggest we
> close this and fix that one. 
> 
> [1] https://issues.dlang.org/show_bug.cgi?id=11466

I missed that one, so yes, we should close this one, thanks.

--


More information about the Digitalmars-d-bugs mailing list