C++ Logo

std-proposals

Advanced search

Re: [std-proposals] String Slicing Draft Proposal

From: Zhihao Yuan <zy_at_[hidden]>
Date: Tue, 26 Mar 2024 22:31:57 +0000
On Tuesday, March 26th, 2024 at 2:10 PM, Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> wrote:

> Understanding what the function does not only happens during writing code, where an IDE helps (perhaps), but also during code reviews and audits and for understanding code snippets (from existing code or added) and changelog diffs. None of those contain the parameter names.

The topic, if leaning towards "how does one programmer
survive in a moving world," is not what I'm getting at.
I raised the suggestion because:

Similarity brings confidence, but extreme similarity can
bring suspects. Their means of resolving the suspicion are
less critical.

As a prior art, JavaScript String provides both .substr and
.substring methods, where the prior accepts (start, count)
and the latter accepts (start, end).

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________
> > -----Ursprüngliche Nachricht-----
> > Von: Zhihao Yuan via Std-Proposals <std-proposals_at_[hidden]>
> > Gesendet: Di 26.03.2024 20:08
> > Betreff: Re: [std-proposals] String Slicing Draft Proposal
> > Anlage: signature.asc
> > An: std-proposals_at_[hidden];
> > CC: Zhihao Yuan <zy_at_[hidden]>; Giuseppe D‘Angelo <giuseppe.dangelo_at_[hidden]>;
> > On Tuesday, March 26th, 2024 at 3:46 AM, Giuseppe D'Angelo via Std-Proposals <std-proposals_at_[hidden]> wrote:
> > 
> > >
> > 
> > > I'm really unsure about this last revision: now you have
> > > std::string::subview which:
> > >
> > 
> > > * does not return a view (so why is it called sub view?);
> > > * has different parameters than the existing substr() despite the very
> > > similar name, so it has a huge surprise factor if one thinks it takes
> > > pos+count (like substr does).
> > 
> > We can call it "substring" to surprise users
> > even more, surprising enough for them to
> > slow down and find the parameter names within
> > the function signature in auto-completion.
> > 
> > --
> > Zhihao Yuan, ID lichray
> > The best way to predict the future is to invent it.
> > _______________________________________________
> > --
> > Std-Proposals mailing list
> > Std-Proposals_at_[hidden]
> > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-03-26 22:32:06