DIP1000: Walter's proposal to resolve ambiguity of ref-return-scope parameters

Walter Bright newshound2 at digitalmars.com
Sat Nov 27 18:24:27 UTC 2021


On 11/27/2021 3:10 AM, Nick Treleaven wrote:
> If we are to support checked memory safety we need more attributes than C++, 
> which doesn't support it. In general attributes could be inferred when the 
> function body is there, but I think that is only implemented for templates ATM. 
> Perhaps it would impact compile-times.

Any case where the source to the function is required, such as template 
functions and `auto` return functions, gets their attributes inferred.

The reason is for consistent behavior if just the function declaration is 
visible, rather than the function definition (i.e. body). The decision is done 
by the canInferAttributes() function.


More information about the Digitalmars-d mailing list