(at least to my knowledge). I was wondering, are there any other instances where
;
is mandatory in Kotlin?
rtsketo
12/03/2021, 3:39 PM
Awesome! Thanks. It didn't even cross my mind to look for it online, I thought no one would be insterted to know something like that in StackOverflow. The case of returning functions it's something I didn't know of.
j
jimn
12/06/2021, 7:15 PM
name() is default to_string in enums but under the jvm at least, there are java naming limitations even if you usethe backticks. in 1.7 this is going to get stricter though i would argue for opting into even fewer restrictions personally.
even with java enum limitations in kotlin you can get away with a lot of metaprogramming using enums, and of course, minimal fixups following semicolon.
https://github.com/0xCopy/1xio/blob/master/src/main/java/one/xio/HttpHeaders.java