new DIP38: Safe references and rvalue references without runtime checks.

Steven Schveighoffer schveiguy at yahoo.com
Mon May 6 12:01:32 PDT 2013


On Mon, 06 May 2013 14:52:23 -0400, Timothee Cour  
<thelastmammoth at gmail.com> wrote:

> Abstract
>
> In short, the compiler internally annotates ref-return functions with
> ref(i1,...,iN) indicating that the function may return argument j
> (j=i1...iN) by reference (possibly via field accesses), where j is
> also a ref input argument. This list can be empty, and if the function
> is a method or internal function, argument 0 refers to implicit 'this'
> parameter. These annotations are used to validate/invalidate ref
> return functions that call such a ref return function. These
> annotations are also written in the automatically generated di
> interface files.
>
> See the DIP38 for more details and examples.

Link: http://wiki.dlang.org/DIP38

In order for this to work, the compiler must mangle according to ref  
specification.  Otherwise, a incorrectly synchronized .di file might link  
code that should otherwise be rejected.

I think this DIP might be too complex for acceptance.

My opinion is we should try the runtime check thing.  I think there will  
be very few cases where it is triggered.

-Steve


More information about the Digitalmars-d mailing list