DIP 36: Rvalue References

Steven Schveighoffer schveiguy at yahoo.com
Tue Apr 23 10:57:16 PDT 2013


On Tue, 23 Apr 2013 13:33:31 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Our intent is to make "ref" always scoped and reserve non-scoped uses to  
> pointers.

So no more returning ref?  Because if you allow returning ref, you lose  
any notion of safety, unless you plan on changing the entire compilation  
model?

> We consider this good language design: we have unrestricted pointers for  
> code that doesn't care much about safety, and we have "ref" which is  
> almost as powerful but sacrifices a teeny bit of that power for the sake  
> of guaranteed safety. Safety is guaranteed by making sure "ref" is  
> always scoped (references can be passed down but never escape their  
> bound value).

Not being able to return ref is a large loss of power.

Not arguing in favor of DIP36, but it seems there is a misunderstanding as  
to what it does.

-Steve


More information about the Digitalmars-d mailing list