new DIP38: Safe references and rvalue references without runtime checks.
Steven Schveighoffer
schveiguy at yahoo.com
Tue May 7 15:15:21 PDT 2013
On Tue, 07 May 2013 15:20:43 -0400, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> On Monday, May 06, 2013 23:28:40 Timothee Cour wrote:
>> Ok, I have updated and simplified the DIP38, please take a look. In
>> the proposed 'manual' scheme A, the user annotates each ref argument of
>> a
>> ref-return function with either inref or outref (let's postpone the
>> discussion of what exactly those keywords should be and focus on the
>> logic instead; see bottom of email for a possibility). In proposed
>> scheme B, the inref/outref are instead
>> automatically infered. Let's focus on scheme A to avoid doing
>> interprocedural analysis.
>
> I confess that my gut reaction to all of this is that it's just plain
> simpler
> to do the runtime check. It won't be needed often and is trivial to
> disable if
> you don't want it. And it requires no annotations whatsoever. We're
> already
> seriously pushing it with the sheer number of annotations that we have,
> so I'm
> very much inclined to argue against adding new ones if we don't really
> need
> them.
While I agree here, and there is the cognitive load of understanding the
attributes to take into account, I like the proposed mechanism to
propagate attributes to the .di file automatically for no-body functions.
That in itself would enable attribute inference, as long as developers of
closed-source libraries agreed to use that mechanism.
-Steve
More information about the Digitalmars-d
mailing list