Prototype of Ownership/Borrowing System for D
Jacob Carlborg
doob at me.com
Thu Nov 21 12:35:03 UTC 2019
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
More information about the Digitalmars-d
mailing list