3 ms·
The problem with nulls in c++ etc. is that every reference type is forced to be nullable. There is no opt out of that semantics. You get passed in an object of
by hjjiehebebe 9y ago
The problem with nulls in c++ etc. is that every reference type is forced to be nullable. There is no opt out of that semantics. You get passed in an object of type O and it is really a sum type of O + Nothing. It means you need to do runtime checks everywhere and reason across call boundaries. You need to look at he code inside that method! That so un-OO!
In Db land you can make a column not nullable. Bit the SQL languages like PLSQL TSQL etc have the same issue.
- Sharlin 9y agoC++ references are non-nullable by design. They are sane in that regard. Pointers are nullable, of course, but at least they are syntactically conspicuous and anyway pretty rare in modern C++.
- heavenlyblue 9y agoI would add: the reason it is a issue in C++ is because the algebra around pointers doesn’t support the NULLs explicitly: - the results of any operations over nulls run as if the pointer were not null - while anyhing you do in SQL with NULL would explicitly have a mapping to either a correct value or another NULL This is all said knowing that it’s quite easy to understand why is that the case.