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

Mike Franklin slavo5150 at yahoo.com
Sun Sep 22 07:54:12 UTC 2019

On Sunday, 22 September 2019 at 07:01:42 UTC, Sebastiaan Koppe 
> I think that taking a reference of a local variable should 
> result in a scope T*.
> In that case `&value` in `y ~= getValue1(&value);` should 
> result in a scope int*.

If that's the case then shouldn't Exhibit B (copied below for 
convenience) require getValue2` to be `int getValue2(scope ref 
int i)`?  If not, what's the justification?

// Exhibit B
int getValue2(ref int i)
     return i;

int* foo2()
     int value;
     int[] y;
     y ~= getValue2(value); // No error
     return &y[0];

More information about the Digitalmars-d mailing list