The Case Against Autodecode

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue May 31 02:35:46 PDT 2016


On Tuesday, 31 May 2016 at 07:56:54 UTC, Walter Bright wrote:
> On 5/30/2016 9:16 PM, Andrei Alexandrescu wrote:
>> On 5/30/16 5:51 PM, Walter Bright wrote:
>>> On 5/30/2016 8:34 AM, Marc Schütz wrote:
>>>> In an ideal world, we'd also want to change the way `length` 
>>>> and
>>>> `opIndex` work,
>>>
>>> Why? strings are arrays of code units. All the trouble comes 
>>> from
>>> erratically pretending otherwise.
>>
>> That's not an argument.
>
> Consistency is a factual argument, and autodecode is not 
> consistent.
>

+1

>> Objects are arrays of bytes, or tuples of their fields,
>> etc. The whole point of encapsulation is superimposing a more 
>> structured view on
>> top of the representation. Operating on open-heart 
>> representation is risky, and
>> strings are no exception.
>
> If there is an abstraction for strings that is efficient, 
> consistent, useful, and hides the fact that it is UTF, I am not 
> aware of it. Autodecoding is not it.

Thing is, more info is needed to support unicode properly. 
Collation for instance.



More information about the Digitalmars-d mailing list