2013/11/11 Marco Leise <[email protected]> > Am Sun, 10 Nov 2013 21:03:34 +0900 > schrieb Kenji Hara <[email protected]>: > > > So, separating "inout postblit' and 'unique postblit' may be reasonable. > > > > (However, it seems to me that the syntax "this(inout this) inout;" looks > > weird... > > > > Kenji Hara > > I see the value in DIP49. There is a hole in the type system > that needs a proper solution and it is astonishing that the > "unique" concept is already there in D, but existed under the > radar of public perception. I haven't read everything, but > agree with making the language more fail safe any time. >
Indeed the "unique" concept is not yet enough described in D language specification. But in recent (past one year or more), it has sometimes been appeared onto various D features, and I had felt about it while working for dmd. The concept had been hidden between D's strong type system (transitive const and immutability) and 'pure' function long time. > I just find inout confusing as well. inout as a wildcard for > const-ness is irritating enough, and with the double meaning > as unique it might be difficult to read code using inout. > Are the two concepts really coupled? Does it make the > implementation of the DIP easier? Or should we have something > like "unique" as a keyword? I think rather it is interesting. Inside inout function, we can treat the inout object as a Schrödinger's cat (It may be mutable or immutable, or the middle of two == const). And the necessary requirement to make a copy from an inout object had derived "unique object" concept. I can agree it looks strange, but there's not any failures of logic, as far as I know. Adding a specific keyword for the concept would hurt the language orthogonality rather. Kenji Hara
