C++ Logo

std-proposals

Advanced search

Re: [std-proposals] String Slicing Draft Proposal

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 26 Mar 2024 22:10:18 +0100
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.   I like (start, end+1), but the differences have to be taken into consideration, especially for small improvements compared to the existing alternative.   -----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 21:10:20