rrader
05/05/2017, 2:08 PMKotlin’s design principle of making important things explicitthan please make that all function have throws in function declaration like in Java
benleggiero
05/05/2017, 2:48 PMpoohbar
05/05/2017, 2:51 PMbenleggiero
05/05/2017, 3:00 PMNullPointerException
, but all other exceptions and errors are completely ignored by the compiler.kirillrakhman
05/05/2017, 3:03 PMevanchooly
05/05/2017, 3:09 PMbenleggiero
05/05/2017, 3:10 PMthrows
or rethrows
, and when you call it you mark the line it's called on with try
(like var x = try danger()
). The best part is that if you use try?
(like var x = try? danger()
), you get an Optional that's null
if it threw. Of course, Swift lets you use `try!`if you really don't care and are OK with it crashing there.
Much less syntax, even more powerful. That's the point of these modern languages. Kotlin's current kludge of using an annotation is ugly and relies on stdlib. That's just... It hurts every time I do it.evanchooly
05/05/2017, 3:13 PMbenleggiero
05/05/2017, 3:14 PMcodeslubber
05/05/2017, 3:22 PMbenleggiero
05/05/2017, 3:24 PMcodeslubber
05/05/2017, 3:27 PMbenleggiero
05/08/2017, 10:51 PMcodeslubber
05/09/2017, 12:03 AMrrader
05/10/2017, 6:48 AMKotlin’s design principle of making important things explicit