Created
July 10, 2013 11:54
-
-
Save erokhins/5965672 to your computer and use it in GitHub Desktop.
Kara.t2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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