Understanding DIP 1000 semantics -- Where's the bug?

Walter Bright newshound2 at digitalmars.com
Thu Sep 26 03:49:49 UTC 2019


On 9/21/2019 7:29 PM, Mike Franklin wrote:
> Which is it?  Where's the bug?  Shouldn't the compiler treat `int* i` and `ref 
> i` consistently?

`ref` semantics are set up so a ref cannot escape the function it is passed to, 
hence there's no error. Pointers have no such restrictions, and so require an 
extra annotation `scope` to acquire the restriction.


More information about the Digitalmars-d mailing list