News for hackers. Stuff that matters.
Re:Kotlin: The Problem with null by yxhuvud on Friday January 12, 2018 @04:26PM (#16136442)
After coding enough Crystal, which instead of optionals have raw and anonymous sum types, I can say this: I don't see the point of a type system where nil is a special case. I don't want optionals, I want to have nil as a totally separate type.
Re:Kotlin: The Problem with null by anaphylactic on Friday January 12, 2018 @05:17PM (#16136831)
Optionals are sum types, too! No special-casing there. It's just that Crystal just has anonymous sum types, I guess, which can be a lot nicer to look at.
Re:Kotlin: The Problem with null by brabel on Saturday January 13, 2018 @04:43AM (#16138938)
Optional is a special case of a sum type where one of the types is Null. If you have Null as a type whose only value is null, then an Optional is just a T|Null. No need for Optional to exist.
Re:Kotlin: The Problem with null by Groxx on Friday January 12, 2018 @08:23PM (#16137723)
Raw being something like `var x : int | str`, and anonymous like `var x = rand() ? 1 : ''` (where int|str is inferred)? Or do you mean something else?
Re:Kotlin: The Problem with null by yxhuvud on Saturday January 13, 2018 @03:01AM (#16138691)
Yes, that is what I meant, yes.