Skip to content

Instantly share code, notes, and snippets.

@erokhins
Created July 10, 2013 11:54
Show Gist options
  • Select an option

  • Save erokhins/5965672 to your computer and use it in GitHub Desktop.

Select an option

Save erokhins/5965672 to your computer and use it in GitHub Desktop.
Kara.t2
open class Attributes {
var name = "No name"
var time = "10:00"
fun invoke(f : Attributes.() -> Unit) {
this.f()
}
}
class A {
class A_ATTR: Attributes() {
var href = ""
fun invoke(f: A_ATTR.() -> Unit) {
this.f()
}
}
val attr = A_ATTR()
}
class TABLE {
class TABLE_ATTR: Attributes() {
var height = 10
fun invoke(f: TABLE_ATTR.() -> Unit) {
this.f()
}
}
val attr = TABLE_ATTR()
}
class TD {
val attr = Attributes()
}
fun main(args: Array<String>) {
with(A()) {
attr {
}
with(TABLE()) {
attr {
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment