3 ms·
What convinced me that Kotlin wasn't for me was Andrey Breslav's reasoning why he insisted on sticking to Scala's confusing "Unit" terminology instead of termin
by amyjess 10y ago
What convinced me that Kotlin wasn't for me was Andrey Breslav's reasoning why he insisted on sticking to Scala's confusing "Unit" terminology instead of terminology that actually makes sense [0].
> Why we don't call it "Void": because the word "void" means "nothing", and there's another type, Nothing, that means just "no value at all", i.e. the computation did not complete normally (looped forever or threw an exception). We could not afford the clash of meanings.
And then he doubles down on it in the comments:
> "Unit" just stands for "something that has only one value", it's a traditional name, comes from functional languages. I agree that this name is not very intuitive, but we failed to invent a better name.
He managed to convince me that Kotlin's highest priority was pointless academic nitpicking, and that's not what I'm looking for in a language. What I wanted was a solid JVM language that avoids all the unnecessary boilerplate of Java without diving headfirst into a morass of functional programming like Scala. I want something that's 100% practicality and straightforwardness, not something that thinks trying to emulate higher math is something to aspire to. Well, I guess there's still Jython, even if it is stuck on an ancient version of Python... (edit: oh, and Groovy... forgot about it because most people just use it for Gradle scripting)
[0] https://stackoverflow.com/questions/22654932/what-is-the-purpose-of-unit-returning-in-functions https://stackoverflow.com/questions/22654932/what-is-the-pur...
- hepta 10y agoThis seems like nitpicking as well. If the intention is that everything is an expression (that seems to be it, to me) then you have to have a Unit, no mater what you call it. I'd rather have a name that 3 academics know than override a distinct concept (Void) or make something entirely new.
- vorg 10y ago> Groovy... forgot about it because most people just use it for Gradle scripting You can use Kotlin for Gradle scripting as well since Gradle 3.0 released about 6 months ago. Given that Gradleware also said they're switching their preferred language for Gradle addons to Kotlin from that version onwards, I'm guessing the same will happen for build scripts some day.