Subject: Re: [SG16-Unicode] code_unit_sequence and code_point_sequence
From: R. Martinho Fernandes (rmf_at_[hidden])
Date: 2018-06-19 13:27:37
On June 19, 2018 8:16:00 PM GMT+02:00, Lyberta <lyberta_at_[hidden]> wrote:
>> On 06/19/2018 04:11 AM, Lyberta wrote:
>> UTF-16 and UTF-32 are convenient for views over u"text" and U"text"
>> respectively.Â And the BE/LE variants are useful as views over (byte
>> oriented) network and file I/O (without having to first convert from
>> encoding scheme to encoding form).
>Yes, but I think those views should not share the same class template.
Why not, though? I can believe you when you say you think that, but that doesn't make it any more convincing than me saying "I think they should be the same class template". There are compelling reasons to make them the same template, mainly that making different templates will just be duplicating the same code, and the same interface.
>> Following the thread further, it seems you would like to have a
>> codec for translating BE/LE data (e.g., to load BE/LE byte oriented
>> into native endian larger-than-byte types).Â That sounds reasonable,
>> I don't see why it should be part of text interfaces.
>I agree and I don't see why BE/LE variants of encodings should be
>parameters to text_view. Maybe we should defer endianness and BOM
Why not? Why treat endianness specially? There's a clear reason to treat BOMs specially: they make the decoding/encoding process stateful. There's no clear reason to do the same for endianness. In the end, UTF-16BE, UTF-8, GB18030, and a bunch of others are just mappings between code points and byte sequences and I see no compelling reason to treat one of those specially.
SG16 list run by herb.sutter at gmail.com