What do you think about adding `Option` class? The...
# stdlib
r
What do you think about adding
Option
class? The use case https://youtrack.jetbrains.com/issue/KT-29026
5
k
Just use a library for it?
3
m
I suspect most people that start down this road rely on https://arrow-kt.io library instead. arrow-core has those, and is relatively small. Then it makes it easier to adopt more functional features.
g
Only “relatively”. Simple Maybe/Option is just 1 class
r
I do not need an entire library, just this 1 class. Also if it will be in stdlib, other libraries, for example for json, will do support for this class out-of-the-box. if it is not in stdlib, it will be the user issue to add support for it
l
m
If all you want is option, then as per Roman's post, just use the built in null of kotlin instead. It's already in the language, is used by libraries already and is handled correctly by the compiler. The only reason to want option is for chaining and other functional approaches, in which case arrow data package is good. Very small with option. Try, either and not much else, and growing in popularity. If all you want is option, what's the benefit over the built in null/empty handling already there?