Why invariants in D 2.0 std.string?

Janice Caron caron800 at googlemail.com
Wed Oct 31 15:04:16 PDT 2007


On 10/31/07, Nathan Reed <nathaniel.reed at gmail.com> wrote:
> Also, doesn't this completely break the library for strings that aren't
> compile-time constants?  I.e. if i do
>
> char[] foo = // read something from a file
> tolower(foo);
>
> won't I get a compiler error now

Possibly, but I believe the new correct way is:
    string foo = assumeUnique(std.file.read(filename));



More information about the Digitalmars-d mailing list