Why invariants in D 2.0 std.string?
    Nathan Reed 
    nathaniel.reed at gmail.com
       
    Wed Oct 31 13:45:08 PDT 2007
    
    
  
Janice Caron wrote:
> I kinda like that.
> 
> I imagine the reasoning is that the library functions will go faster,
> because they can be optimised better.
How does invariant allow better optimization than const?
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, since char[] can't be implicitly 
converted to invariant(char)[]?  (On the other hand, both char[] and 
invariant(char)[] can be converted to const(char)[]?)
Thanks,
Nathan Reed
    
    
More information about the Digitalmars-d
mailing list