C++ Logo

std-proposals

Advanced search

Re: [std-proposals] String Slicing Draft Proposal

From: Rhidian De Wit <rhidiandewit_at_[hidden]>
Date: Wed, 27 Mar 2024 09:22:14 +0100
Hi,

I understand the potential confusion stemming from *.subview()* not
returning a view, but a string.
Although I'd also urge people to read up on functions before assuming what
it does, we could also try to come up with what it does.
I agree with an earlier point that *.slice()* sounds like it might actually
slice the string, which is not the case, therefore I suggest *.sliced()*.

I'd like to keep the name concise, since part of my point in the paper is
that this new function would lead to less code written at times, and making
the function name very explicit defeats the purpose of writing less code.

Personally, my preference remains at *.subview()*, and if such confusion
arises during code-reviews (for example), you're always only 1 cppreference
link away from the answer.
However, I think *.sliced()* is a reasonable alternative if the majority of
this mailing list feels that *.subview()* is misleading.

Sincerely,

Op wo 27 mrt 2024 om 02:51 schreef Sebastian Wittmeier via Std-Proposals <
std-proposals_at_[hidden]>:

>
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
>
>
>
> .substr seems to be deprecated? And never been intended to be part of
> EcmaScript?
>
>
> -----Ursprüngliche Nachricht-----
> *Von:* Zhihao Yuan <zy_at_[hidden]>
>
> As a prior art, JavaScript String provides both .substr and
> .substring methods, where the prior accepts (start, count)
> and the latter accepts (start, end).
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>


-- 
Rhidian De Wit
Software Engineer - Barco

Received on 2024-03-27 08:22:28