Prototype of Ownership/Borrowing System for D
Walter Bright
newshound2 at digitalmars.com
Wed Nov 20 22:15:18 UTC 2019
On 11/20/2019 5:51 AM, rikki cattermole wrote:
> If this is the case then perhaps making all pointers non-null
> (with asserts) would make sense.
I originally was going to add null to the data flow analysis. But I realized it
would be rather useless:
T* foo();
T* p = foo(); // is p null or not?
Very quickly, the flow analysis would drop into "dunno if it is null or not" so
it just won't be worth much.
In order to make non-null checking actually work, the language semantics would
likely need to change to make:
T* a non-null pointer
T?* an optionally null pointer
or something like that. Two different pointer types would need to exist.
Something like this is orthogonal to what @live is trying to do, so I put it on
the shelf for the time being.
More information about the Digitalmars-d
mailing list