Steve Teale Wrote: > On Fri, 19 Nov 2010 08:25:17 -0500, Jason House wrote: > > > A cast to immutable is required when constructing immutable objects. The > > type system can't prove that's safe. It's a design limitation to keep > > complexity low. > > > Jason, > > But design limitations like that will force programmers who are on a > tight schedule to just say __gshared, and to hell with it. > > Languages can't be designed just on theory - some recognition of > practicality is also required.
I didn't say I liked the need for the cast or even that I think D has the proper design! IIRC, the cast with object creation was in lieu of adding "unique" tepe qualifier and the extra complexity to get that right. In your example, I believe the object was created once, so a cast really isn't that bad. The bad part to me was the need to cast away immutability with every use. That's why I encouraged a bugzilla entry. I did't check this case, but Phobos had a bad track record with adopting type qualifiers after they were added to D2.
