Copying copy?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Jul 26 07:13:17 PDT 2013


On Fri, Jul 26, 2013 at 02:48:05PM +0200, monarch_dodra wrote:
> On Friday, 26 July 2013 at 12:16:02 UTC, bearophile wrote:
> >Ali Çehreli:
> >
> >>I agree. I would expect copy to maintain the same type.
> >
> >http://d.puremagic.com/issues/show_bug.cgi?id=10718
> >
> >Bye,
> >bearophile
> 
> I reacted to your bug entry. I don't think copy's behavior should be
> *changed*. That would violate the entire "a string is a range of
> dchar" thing.
> 
> However, copy could be improved with the knowledge that a dchar can
> be streamed into a series of chars (EG, the way an appender!(char[])
> can handle taking a dchar), and improved to handle cases it didn't
> handle before.

+1. I like this much better than breaking the "string is a range of
dchar" abstraction, which is built into Phobos in many places. Much
better to say that it's OK to write dchars into string, because they can
be recoded into UTF-8.

This does make me wonder, should we support dchar -> string conversion
in general? I see that appender supports that, which is great, but what
about language-level support (say, string ~ dchar)?


T

-- 
Tech-savvy: euphemism for nerdy.


More information about the Digitalmars-d-learn mailing list