fun tableView(init: Table.() -> Unit) { Table().init() } var result = "fail" class Table { inner class TableColumn(val name: String) { } fun column(name: String, init: TableColumn.() -> Unit) { val column = TableColumn(name).init() } } fun foo() { tableView { column("OK") { result = name } } } fun box(): String { foo() return result }