Kotlin’s type conversion is the best I’ve ever seen!

I’ve been learning a few different languages over the holidays (I’ve been off work all December)

I’m a PHP / JS dev in my day job, but I’ve been doing some Advent of Code challenges in the following languages to see which I might like to pursue more seriously:

  • Go
  • Elixir
  • Zig (I was gonna do Rust here but Zig feels a bit easier for now)
  • Kotlin

It was actually in that order too. I already knew I liked Kotlin’s syntax the most of any on the list, so I decided to leave it to the end. Now I’ve been 3 days exclusively using Kotlin, and I think it’s winning the race by a LONG way after I realised you can split a string into a charlist just by doing:

val data: String = "Advent Of Code txt file contents here" val charList: List<Char> = data.toList() 

That same things was such a pain in the hole in Go. Litterally took me an hour learning all about Runes, and how GO stores chars as Bytes. I definitely did it the hard way, but the whole Rune/Bytes thing seems like overkill for most things. Granted I need to look into their ‘Strings’ stdlib more. I would use go if I was building a translation system however. It is powerful in that regard.

Anyways, does anyone have any other cool things they are liking about Kotlin vs another language?

submitted by /u/LukeWatts85
[link] [comments]