https://kotlinlang.org logo
Title
c

cosmicexplorer (inactive)

09/13/2018, 6:34 AM
realized i couldn't get all the way into it so leaving it as a WIP for now and will get to it in the next few days, but i'm pretty sure the idea here will work (allowing duplicate PathStats in a Snapshot if they originate from the same base directory): https://github.com/pantsbuild/pants/pull/6500
g

gildor

09/13/2018, 6:34 AM
if(obj != null)
is not bad itself Maybe you could show to your team members good examples how to eliminate nullability in particular cases
j

jovmit

09/13/2018, 6:38 AM
For the code that we don't control there is no other way. We must check the nulls. But I wouldn't agree that we have to make everything nullable in the code we own and control.
Seems better to get back to Java which btw introduced Optional. But will try showing some nice examples. Thanks for the advice
g

gildor

09/13/2018, 6:44 AM
Back to Java? Why?
Work with Optional is much-much more verbose than with nullable in Kotlin
And also adds overhead
j

jovmit

09/13/2018, 6:46 AM
Right, but I meant even Java tries to wrap the null into am object. The null is not an object and into my eyes simply doesn't fit in the OOP
Especially not in FP
g

gildor

09/13/2018, 6:46 AM
I disagree
null is completely fine in OOP
and in FP if you not a radical about this
j

jovmit

09/13/2018, 6:47 AM
Well ok. I was asking for arguments against it, not for it :)
g

gildor

09/13/2018, 6:47 AM
Kotlin gives a power or type system and tools to handle nullability gracefully
Because code without nulls looks better, you have less condition, easier to write and support
j

jovmit

09/13/2018, 6:48 AM
And maintain
g

gildor

09/13/2018, 6:49 AM
Just take some class and elliminate nulls where it’s possible to show an example for team mates
j

jovmit

09/13/2018, 6:51 AM
That's something we are going to try for sure. That's great point.
g

gildor

09/13/2018, 6:51 AM
Also some idioms help to improve code with nulls in some cases, like early return, default arguments and so on