Ranges and Exception handling PR 2724

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 20 08:13:33 PST 2014


On Thu, Nov 20, 2014 at 11:57:41AM +0000, Robert burner Schadek via Digitalmars-d wrote:
> On Wednesday, 19 November 2014 at 05:49:55 UTC, H. S. Teoh via Digitalmars-d
> w
> >From what I understand, this PR is proposing to add a range wrapper
> >that catches exceptions thrown from range primitives and passes them
> >to a user-specified handler. Seems to be a promising idea, but it's
> >probably
> 
> It is exactly that:
> 
>     auto s = "12,1337z32,54,2,7,9,1z,6,8";
> 
>     auto r = s.splitter(',')
>         .map!(a => to!int(a))
>         .handleBack!(ConvException, (e, r) => 0)
>         .array;
> 
>     assert(equal(h, [12, 0, 54, 2, 7, 9, 0, 6, 8]));

Unfortunately, it looks like people are more interested in arguing about
signed vs. unsigned instead of reviewing new Phobos features. *sigh* :-(


T

-- 
PNP = Plug 'N' Pray


More information about the Digitalmars-d mailing list