Skip to content

Instantly share code, notes, and snippets.

View udalov's full-sized avatar

Alexander Udalov udalov

View GitHub Profile
@udalov
udalov / gist:3645169
Created September 5, 2012 21:31
data class example
data class Result(val x: Int, val y: String)
fun computeSomething(): Result {
return Result(42, "")
}
fun main() {
val (x, y) = computeSomething()
println(x)
println(y)
@udalov
udalov / api.kt
Last active August 29, 2015 14:23
Sketch of a more type-safe reflection API for Kotlin
@file:suppress("UNCHECKED_CAST", "BASE_WITH_NULLABLE_UPPER_BOUND", "UNUSED_PARAMETER")
interface KElement
// Class, package, type
interface KDeclarationContainer : KElement {
val allMembers: Collection<KElement>
}