[Development] QUtf8String{, View}

Matthew Woehlke mwoehlke.floss at gmail.com
Mon May 25 16:24:23 CEST 2020

On 25/05/2020 07.37, Edward Welbourne wrote:
> I would just call it QUtf8View, since (see below) I don't see value in a
> separate QUtf8String for it to be a view into

On the one hand...

std::string_view is not a view into a std::string. A std::string is a 
*container* for text, a std::string_view is a *view* for text. They both 
have 'string' in their name because they both deal with text, not 
because a std::string_view is a view of a std::string. Similarly, a 
QStringView may or may not be a view of a QString. Thus, it does not 
follow that having a QUtf8StringView in any way implies relation to, or 
existence of, a QUtf8String.

On the other hand, "Utf8String" is arguably redundant. But so is 
"Latin1String", which we already have.

I think, for the sake of existing precedent, QUtf8StringView is the 
correct name. If you are under the (mistaken) impression that an 
XStringView implies being a view of an XString, well, sorry, but that's 
just not the case, for any value of 'X' ('std::', 'Q', 'QUtf8', ...).

On a different note, if we *had* QUtf8String and something like 
QAnyString, it might help with a migration path by which we eventually 
rename QString to QUtf16String (likely with an alias initially) and 
eventually make QString an alias for QUtf8String instead.


More information about the Development mailing list