Subject: Re: [std-proposals] function at() for span<> that throws exception on out-of-range, like vector and array ::at()
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2019-11-30 10:41:56
On Sat, 30 Nov 2019 at 18:31, Lyberta via Std-Proposals
> Ville Voutilainen via Std-Proposals:
> > The argument is that an exception that would be thrown by at() is a
> > logic error in the program
> How is sanitizing user input a logic error?
Ahem. You can't make me defend that argument. :) I have worked in
environments where random
bogeyghosts don't just appear from thin air (as in, "but if you try to
protect your users from one kind
of logic errors, they'll run into worse ones, so it's better to punish
them everywhere in order to
magically teach this particular point"), and it's splendidly useful to
be able to tell them something along
the lines of "write simple code; if bad things happen, they will be..
erm.. thrown to layers written by
experts, for handling the bad things".
I am merely trying to explain the argument. I am not defending it. I
am perfectly willing to admit
that I am to some extent attacking it.
STD-PROPOSALS list run by herb.sutter at gmail.com
Standard Proposals Archives on Google Groups