|
|
|
|
|
by stouset
1488 days ago
|
|
Type systems can enforce that types always contain a value of that type and cannot be null. There is another type that is either null or a value of the enclosed type. At any boundary where something might be null, you do the null check. If it's null, you do whatever logic is necessary right there and only right there. That might be to skip the computation, to use a default value, to get the value from somewhere else, to return an error, or whatever. If it's not null, you use the internal value and from then on every user can operate on a guarantee that it's not null. |
|