C++ Logo

STD-PROPOSALS

Advanced search

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:47:41


On Sat, 30 Nov 2019 at 18:40, John McFarlane via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
>
> On Sat, 30 Nov 2019 at 16:31, Lyberta via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> 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?
>
>
> It's not.
>
> Sanitizing user input sounds like something that is best served by explicit logic. I certainly don't think that UI is any concern of containers.

That's a very salient point, and I wonder to what extent we find the
same things similarly intriguing about that.
The "UI" of the standard containers already does M things for N users,
and some permutations don't like
some combinations. Yet that hasn't been a show-stopper problem thus
far. I have principled dulcet tones
against a language standard having principled dulcet tones about "this
is how you should program, that thing
over there is not how you should program, and regardless of your
rationale, we are going to make principled
decisions about what's good and what's not". I am not necessarily
against a language standard making its
best effort to encourage good solutions and discouraging bad
solutions, but the 'good' threshold of that is
one of my pet peeves. I am a big fan of the train of thought "C++
programmers are not idiots, and they don't
need a cabal to protect them".


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups