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

Walter Bright newshound2 at digitalmars.com
Thu Nov 25 08:20:32 UTC 2021


On 11/25/2021 12:12 AM, Dukc wrote:
> This raises a question: will `return ref return scope` become allowed?

No.

Consider the following code:

   void* func(T** p, bool b)
   {
      if (b)
	return p;
      else
         return *p;
   }

I propose that such code has quite a smell emanating from it, and so don't see a 
good reason to support `return ref return scope` as that will endorse such code.



More information about the Digitalmars-d mailing list