On 10 April 2013 16:11, Zach the Mystic <[email protected]> wrote:
> On Wednesday, 10 April 2013 at 05:21:40 UTC, Manu wrote: > >> Why are you suggesting changing scope to imply ref? This seems wrong. >> scope >> and ref are separate, should remain that way. >> > > To be clear, I suggested it, not Kenji. The reason scope could imply ref > is that no value type is ever unsafe. It is though, in the case I demonstrated. A value type can aggregate a reference type, and by-val scope would prohibit any part of the copy from escaping in turn. This is tricky, but I think it would be an important enhancement for non-ref scope variables and @safe-ty. It might be impractical, but it's something to think about anyway... If you copy the value you're passing, there's no way the reference could > escape the scope, because there's no reference! A delegate has an implicit > pointer and is inherently a reference type, which is why it can work with > 'scope'. In all likelihood 'scope' implying 'ref' would needlessly > complicate the type system, in exchange for the convenience of only having > to type either 'scope' or 'ref' depending on what you wanted. But I > suggested it because I at least wanted it to be discussed. > Fair enough.
