Prototype of Ownership/Borrowing System for D

Jacob Carlborg doob at
Thu Nov 21 12:35:03 UTC 2019

On Wednesday, 20 November 2019 at 22:15:18 UTC, Walter Bright 

> 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 
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 

Basically there wouldn't be "null" anymore.

/Jacob Carlborg

More information about the Digitalmars-d mailing list