The Case Against Autodecode
Marc Schütz via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jun 2 06:48:02 PDT 2016
On Thursday, 2 June 2016 at 13:11:10 UTC, Steven Schveighoffer
wrote:
> On 6/1/16 6:31 AM, Marc Schütz wrote:
>> 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.
>
No, I don't want to make string a range of anything, I want to
provide an additional overload for joiner() that accepts a
const(char)[], and returns a range of chars.
The remark about the joining element is that
["abc", "xyz"].joiner(","d)
should convert ","d to "," first, to match the element type of
the elements. But this is purely a convenience; it can also be
pushed to the user.
> If you want to special-case joiner for strings, that's always
> possible.
Yes, that's what I want. Sorry if it wasn't clear.
> 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