|
|
|
|
|
by goto11
1712 days ago
|
|
> Other languages refer to null as their billion dollar mistake The "billon dollar mistake" as described by Tony Hoare was not nulls per se. The billion dollar mistake was having a type system where null was a member of every reference type. This does not apply to language like JavaScript without static type checking, and it doesn't apply to type systems like TypeScript where null or undefined have to be explicitly specified as members of a type. The undefined/null distinction solves an additional problem: In Java you don't know if a value is null because a field wasn't initialized correctly or because it was deliberately set to null. JavaScript allows you to distinguish between these two scenarios. |
|