[dmd-beta] dmd 1.065 and 2.050 beta

Jonathan M Davis jmdavisProg at gmx.com
Wed Oct 27 22:24:35 PDT 2010


On Wednesday 27 October 2010 19:52:42 Steve Schveighoffer wrote:
> ----- Original Message ----
> 
> > From: Jonathan M Davis <jmdavisProg at gmx.com>
> > 
> > Well, this change  is going to break a lot of code (and the fact that
> > string literals are  immutable on Linux but not Windows sure isn't going
> > to help with
> > 
> > code  portability). We really need to find a permanent solution for this
> >
> >problem
> >
> > soon.
> 
> You are misunderstanding the issue.
> 
> In an immutable(char)[], the array is mutable, the data it points to is
> immutable.  The case being discussed is immutable(char[]), where both the
> data being pointed to *and* the array itself are immutable.  You should
> not be able to call popFront on such an array.  In no case is the compiler
> allowing you to change the immutable data being pointed to, that's not
> what the bug is about.
> 
> I agree with everything David has said about it, breaking existing code now
> is a much better solution than breaking it later, especially when Phobos
> is in such a volatile state.

The problem is string literals. Aren't string literals immutable(char[])? It 
seems incredibly stupid to have to write

str.startsWith("hello"[])

instead of

str.startsWith("hello")


Now, if some sort of implicit conversion needs to take place here and works 
because it's a temporary, then that's fine with me. But having to throw around 
extra [] is going to be really annoying. Sure, in the general case, immutable 
ranges shouldn't work - that makes sense - but if string literals fall in that 
category, _that_ is what I have a problem with.

- Jonathan M Davis


More information about the dmd-beta mailing list