DIP1000: The return of 'Extend Return Scope Semantics'

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Jun 12 18:18:18 UTC 2021


On Saturday, 12 June 2021 at 18:12:34 UTC, Dennis wrote:
> `scope` currently applies to the pointed-to-object. For 
> structs, it is applied to each member that is a type with 
> pointers. For `struct Ptr {int* ptr;}`, a `scope Ptr` is 
> treated the same as a `scope int*`. For `struct Handle { int 
> handle; }`, a `scope Handle` is treated like `scope int` (which 
> gets its `scope` stripped away because it has no pointers).

Ok, I get it (?) So basically it works if one always transfer 
smart pointers by value. Although, something like a linked list 
would not work as it isn't transitive and there is no way to make 
it transitive? Or?




More information about the Digitalmars-d mailing list