class Dynamic public fun jsonOf(i: Int): Dynamic = TODO() public fun jsonOf(s: String): Dynamic = TODO() // ... public fun jsonOf(l: List): Dynamic = TODO() private fun jsonOf(x: Any?): Dynamic = when (x) { is Int -> jsonOf(x) is String -> jsonOf(x) // ... is List<*> -> jsonOf(x) else -> error("entered unreachable code: $x") }