string is rarely useful as a function argument

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Dec 31 11:06:53 PST 2011


On 12/31/11 10:47 AM, Sean Kelly wrote:
> I don't know that Unicode expertise is really required here anyway.
> All one has to know is that UTF8 is a multibyte encoding and
> built-in string attributes talk in bytes. Knowing when one wants
> bytes vs characters isn't rocket science. That said, I'm on the fence
> about this change. It breaks consistency for a benefit I'm still
> weighing. With this change, the char type will still be a single
> byte, correct? What happens to foreach on strings?

Clearly this is a what-if debate. The best level of agreement we could
ever reach is "well, it would've been nice... sigh".

It's possible that we'll define a Rope type in std.container - a
heavy-duty string type with small string optimization, interning, the
works. That type may use insights we are deriving from this exchange.


Andrei


More information about the Digitalmars-d mailing list