On 13/05/14 15:36, Dicebot wrote:
There are 2 `scope` uses to think about. One is storage class and in
that context `scope` is more of owned / unique pointer. Other is
parameter qualifier and that one is closer to ref / borrowed pointer.
Main problem about making `ref` borrowed pointer is that you will need
to prohibit storing it in function transitively. This will need to
become invalid code:
struct A
{
int* ptr;
}
int* gptr;
void foo(ref A a)
{
gptr = a.ptr; // error, can't leak borrowed a.ptr into global context
}
This feels like too much of a breakage, this is why `scope` (or `scope
ref`) feels more appropriate.
I always though "scope" would behave like that.
--
/Jacob Carlborg