News for hackers. Stuff that matters.
Re:From zero to 10M lines of Kotlin by treis on Tuesday October 25, 2022 @02:44PM (#33334582)
Yeah, my question is more about what you do as a consumer. How do you get back null safety if every field in the response is optional? Even moreso, in a SOA situation where 90% of what you work with comes across a HTTP boundary.
Re:From zero to 10M lines of Kotlin by acchow on Tuesday October 25, 2022 @03:46PM (#33335251)
I'm not sure I understand the question. If you have only Optionals and Null does not exist, a NPE is impossible. The Optional type forces you to handle the empty case, so null safety is enforced by the type system.
Re:From zero to 10M lines of Kotlin by treis on Tuesday October 25, 2022 @04:03PM (#33335429)
The question is how do you handle the empty case for the hundreds of fields you pull from other systems.
Re:From zero to 10M lines of Kotlin by acchow on Tuesday October 25, 2022 @06:12PM (#33336841)
You handle it how you would have handled fixing a NPE which shows up in production. Except now you handle it before an NPE ever shows up because the type system forces you to.