archives

Nullable type is needed to fix Tony Hoare's "billion dollar mistake".

The Nullable type is needed to fix Tony Hoare's "billion dollar mistake".
But implementing the idea is full of pitfalls, e.g., Null by itself should not be an expression.

is the terminator to mark the end of a top level construct.
An Expression◅aType▻ is an expression which when executed returns aType.

In an expression,
1. followed by an expression for a nullable returns the Actor in the nullable or
throws an exception iff it is null.
2. Nullable followed by an expression for an Actors returns a nullable with the Actor.
3. Null followed by aType returns a Nullable◅aType▻.
4. ⦾? followed by an expression for a nullable returns True iff it is not null.

Illustrations:
* 3▮ is equivalent to Nullable 3▮
* Null Integer▮ throws an exception
* True is equivalent to ⦾?Nullable 3▮
* False is equivalent to ⦾?Null Integer▮

In a pattern:
1. followed by a pattern matches a Nullable◅aType▻ iff
it is non-null and the Actor it contains matches the pattern.
2. Null matches a Nullable◅aType▻ iff it is null

Illustrations:
* The pattern ⦾x matches Nullable 3 , binding x to 3
* The pattern Null matches NullInteger

Edited for clarity