On Thu, Dec 04, 2014 at 04:31:18PM -0800, Walter Bright via Digitalmars-d wrote: > On 12/4/2014 3:04 PM, deadalnix wrote: > >So as mentioned, there are various problem with this DIP : > > - rvalue are defined as having a scope that goes to the end of the > > statement. > >That mean they can never be assigned to anything as per spec. > > I don't believe this is correct. Rvalues can be assigned, just like: > > __gshared int x; > { int i; x = i; } > > i's scope ends at the } but it can still be assigned to x. [...]
Well, the "Expressions" section defines certain lifetimes to be infinity, however, it contradicts the definition of an rvalue's lifetime given under "Definitions" - "Lifetime", which states that an rvalue's lifetime lasts only to the end of the statement. This would imply that the following ought to be rejected: int x = 1 + 2; // lifetime(1 + 2) = end of statement // but lifetime(x) = infinity Sounds like the Definitions section is not precise enough. :-) T -- Curiosity kills the cat. Moral: don't be the cat.