Prototype of Ownership/Borrowing System for D

rikki cattermole rikki at
Thu Nov 21 13:08:34 UTC 2019

On 22/11/2019 1:35 AM, Jacob Carlborg wrote:
> On Wednesday, 20 November 2019 at 22:15:18 UTC, Walter Bright wrote:
>> 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.
> That would be really nice. But instead it would be just one pointer type 
> and arbitrary  optional types:
> T*           a regular pointer (can't be null)
> T*?         an optional pointer (can point to something or can be empty)
> int           a regular int
> int?         an optional int (can contain an int or can be empty)
> Object    a regular reference type (can't be null)
> Object?  an optional reference (can point to something or can be empty)
> Basically there wouldn't be "null" anymore.
> -- 
> /Jacob Carlborg

If we look at @live as a superset of @safe (basically @safe on steroids) 
which is the way I'm looking at it, all pointers in @live code would 
have to be non-null if they are alive (so viewable / owned).

It simplifies the language some what, and allows us to use something 
like Nullable for optional values.

While it is good that we are thinking about it, it can be put off while 
Walter gets the rest working (as he has been saying in essence).

More information about the Digitalmars-d mailing list