betterC becoming unusable

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 7 14:46:41 UTC 2022


On 11/7/22 4:50 AM, rikki cattermole wrote:
> On 07/11/2022 4:59 PM, Steven Schveighoffer wrote:
>> 2. Array comparison sometimes fails to link. That's right `string1 == 
>> string2` may fail depending on whether the compiler decides that the 
>> support template in druntime needs to be emitted to the object file. 
>> This is unacceptable. If I have to use `strcmp` in betterC, I might as 
>> well just use C.
> 
> Lets dig a bit.
> 
> https://github.com/dlang/dmd/blob/master/druntime/src/core/internal/array/comparison.d
> 
> It is templated (so it should already be emitting correctly).
> 
> https://github.com/dlang/dmd/blob/master/druntime/src/core/internal/string.d#L239
> 
> Also templated.

Yes, it's the template that is not being emitted. Whatever the reason, 
it's unacceptable.

> But why on earth is UTF-8 strings specially cased and not UTF-16 or UTF-32?
> 
> Thats not right...
> 
> No sanitization, its basically just byte for byte comparison. Which is 
> the wrong way to compare Unicode strings anyway (and requires the tables)!

An array comparison is an array comparison, regardless of element type. 
I want to see if my array of code units is exactly the same as another 
array of code units. I don't care about sanitization because that's not 
what I'm asking for. I don't need unicode tables to tell me if "4.2.0" 
is the same as "4.2.0".

This focus on unicode is a complete distraction, pretend it's a byte 
array, same problem.

-Steve


More information about the Digitalmars-d mailing list