|
|
|
|
|
by chriswarbo
1883 days ago
|
|
> For instance, if you're collecting information, but wont know everything at creation time, the unknown values are null. I find the idea of 'creating unknown values' to be self-contradictory. I find it much more logical to define a PartialFoo containing only the parts we know up-front, and a fill in the rest later using a function PartialFoo -> Foo. If we need multiple steps, we can put some Optional fields in the PartialFoo, to avoid lots of intermediate types. This is still annoying, but it keeps all of the 'intialisation headaches' separate from the Foo type itself; so code dealing with Foo doesn't have to care about null checks, missing fields, etc. |
|
You juat described the purpose of SQL's NULL.