News for hackers. Stuff that matters.
Re:Modern PHP without a framework by patricklouys on Sunday April 01, 2018 @06:20AM (#16727602)
PHP handles null better than Java. That's the one thing that kept me from switching to Java tbh.
Re:Modern PHP without a framework by linoge on Sunday April 01, 2018 @07:42AM (#16727787)
Implying that having null is a good idea at all.
Re:Modern PHP without a framework by gtsteve on Sunday April 01, 2018 @01:57PM (#16729558)
So 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?

Re:Modern PHP without a framework by paulddraper on Sunday April 01, 2018 @03:43PM (#16730037)
See the Option/Maybe pattern, which uses sum types rather than unions or sentinel values.

https://www.lucidchart.com/techblog/2015/08/31/the-worst-mis...

Re:Modern PHP without a framework by patricklouys on Sunday April 01, 2018 @08:02AM (#16727832)
There is nothing wrong with using null in PHP...
Re:Modern PHP without a framework by RhodesianHunter on Sunday April 01, 2018 @09:33AM (#16728175)
Check out Kotlin.

String is not nullable String? Is nullable and the compiler/ide will force you to check for null when you use it.