The Case Against Autodecode

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 2 06:11:10 PDT 2016


On 6/1/16 6:31 AM, Marc Schütz wrote:
> On Wednesday, 1 June 2016 at 01:13:17 UTC, Steven Schveighoffer wrote:
>> On 5/31/16 4:38 PM, Timon Gehr wrote:
>>> What about e.g. joiner?
>>
>> Compiler error. Better than what it does now.
>
> I believe everything that does only concatenation will work correctly.
> That's why joiner() is one of those algorithms that should accept
> strings directly without going through any decoding (but it may need to
> recode the joining element itself, of course).

This means that a string is a range. What is it a range of? If you want 
to make it a range of code units, I think you will lose that battle.

If you want to special-case joiner for strings, that's always possible. 
Or string could be changed to be a range of dchar struct explicitly. 
Then at least joiner makes sense, and I can reasonably explain why it 
behaves the way it does.

-Steve


More information about the Digitalmars-d mailing list