What should zip throw?
Dukc via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 19 05:59:46 PDT 2017
I decided to try adding an overload to Zip which remembers it's
stopping policy at compile time. But I encountered another
strange design.
When stopping policy is set to requiring a same length, and it is
not so, it throws a regular exception. I think this is
inconsistent with rest of the language, because according to TDPL
exceptions are meant to intercept normal things the programmer
has no control over, Mainly I/O failures as I understand it.
But here, if someone zips ranges of different length, it is
clearly a programmers error, not corrupted input. So shouldn't it
assert() the length (and be nothrow) instead?
And what would you think if I redesigned it so while I'm on it?
More information about the Digitalmars-d
mailing list