4 ms·
PHP handles null better than Java. That's the one thing that kept me from switching to Java tbh.
by patricklouys 8y ago
PHP handles null better than Java. That's the one thing that kept me from switching to Java tbh.
- linoge 8y agoImplying that having null is a good idea at all.
- patricklouys 8y agoThere is nothing wrong with using null in PHP...
- gtsteve 8y agoSo how would you represent an absence of a value? In an enum that'd be easy, but there is a semantic difference between an empty string and a null string. Or would you propose sending a boolean to indicate null as well as a string in a data type?
- paulddraper 8y agoSee the Option/Maybe pattern, which uses sum types rather than unions or sentinel values. https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/ https://www.lucidchart.com/techblog/2015/08/31/the-worst-mis...
- RhodesianHunter 8y agoCheck out Kotlin. String is not nullable String? Is nullable and the compiler/ide will force you to check for null when you use it.