[Issue 18790] can't put a const(char)[] into a char[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 22 11:36:54 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18790

--- Comment #8 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Jonathan M Davis from comment #7)
> And if
> we can make the changes for output ranges without breaking any existing
> code, then we definitely should.

The only place where I see it may break code is that people have implemented
specialized versions of functions that work with char[] arrays since they are
not output ranges. This is going to create ambiguity errors, since you could
call both functions with a char[] now. I had to deal with this in phobos in a
couple places when creating this PR. In one case, the char[] version was
returning a DIFFERENT result type, so I couldn't just remove the char[]
version. There, I used template constraints to differentiate, no big deal.

In the second case, it's a bit more complex. When we are translating from one
character type to another, suddenly the put function loses its nothrow status.
For those who are handling the translation directly, and are assuming simple
transcoding (i.e. you know it's only ascii), their "workaround" function is
bound to be nothrow, meaning you can't use put directly.

In practice, I'm not sure how much code this will affect. I also don't know how
to do this through a deprecation.

--


More information about the Digitalmars-d-bugs mailing list