
strpos, str_rot13, mysql_real_escape_string, base64_decode, htmlentities
you can cast values to unset which does nothing. If modern is defined as just having up-to-date/new stuff being added to it, I will go ahead and say PHP. JS isn't exactly "modern" if you define modern as the age of the language. However, if you want a language that's very comfortable to program in, I think Kotlin does that better than any other language because they literally made so many tradeoffs in that direction. I'm not even sure I believe in the concept of best language. One where they prioritise ergonomics very high.ĭo I consider Kotlin to be the best language? Not really. That put's some limits on how ergonomic they can make it. Swift put's a high premium on performance and compile-time optimisation. Part of this is tradeoffs and limitations. I also want to stress that I don't think modern languages as unergonomic, just that Kotlin is more ergonomic. Kotlin does many things that make it more ergonomic. Rust makes the opposite choice (and excellent language too, just one that makes different tradeoffs). This of course means Kotlin does sacrifice some safety to achieve ergonomics. They also made pragmatic choices so nullability doesn't make working with existing code too much of a hassle. Interoperating with Java is seamless which means you have a wealth of libraries to work with and it just works. There are many languages that lead you in this direction, but they are often unfriendly and make it hard to work with other languages.
If being an expression (replacing the need for ternary operator) aids in this as well. You see this in control structures as well since you can return from most of them. Kotlin gently leads you towards more immutable and functional code (val keyword, data structures that are immutable by default) yet have no problem allowing you to engage in more traditional mutating OOP if you so want or need to. (Yeah I know that Kotlin runs other places than the JVM, but its design is very informed by Java and the JVM.)
I think one sentence that sums it up is this: Kotlin is pragmatic JVM-language that gently guides you towards what we know are good practices in programming yet gives you the freedom to do things in a variety of ways without too much trouble.
Its features, its how the language deals with paradigms. It's more about the big picture and the language as a whole, and not only the language but the tooling too. I don't think I can boil down what makes Kotlin more ergonomic down to one feature.