:sob::sob::sob::sob::sob::sob::sob::sob::sob::sob:...
# k2-adopters
s
😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭😭 Whyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy! God please nooooooooooooooooooooooooooooooooooooo! Why not just use s*ealed classes?*
e
To put
NotFound
in a different package or module? To avoid wrapping success value in
Result.Success
? To avoid any inheritance dance to satisfy compiler? I believe there is KEEP for this will such explanations.
☝️ 1
s
Why not use value class to avoid unboxing and enable making them local? Union types easily misused and starts a way to add a lot of bad code just like what in happening in Type Script!
e
Oke, it is not exactly as TS, but I'm not expert and I would wait for more experienced/grounded answer. Value classes has own limitations. You can not extend it, it allows only one value for wrapping, etc.
πŸ‘ 2
Not sure also if value classes are working for KMP now
j
if you block anything that can be misused then directly delete any programming language.
πŸ‘ 2
c
Not sure also if value classes are working for KMP now
Yes, value classes are available on all platforms.
πŸ‘πŸΌ 1
s
if you block anything that can be misused then directly delete any programming language.
@Javier! that what people said when Edgar Dijkstra said: Go To Statement Considered Harmful
c
@Shalaga44 I wholeheartedly agree with you. We already have many constructs to return multiple different types. Sealed classes (the closest we have to sum types in Kotlin) are probably the best pick. With this proposal we add to the cognitive load for reading the language (
!
means even more things), and it makes it harder to decide what's the idiomatic way to write something. But then I also have to say that the Kotlin creators probably thought really deep about this. So I'm mainly shooting from the hip here.
πŸ’œ 1