6
我调查这个科特林例如接收器功能类型:在斯卡拉
class HTML {
fun body() { ... }
}
fun html(init: HTML.() -> Unit): HTML {
val html = HTML() // create the receiver object
html.init() // pass the receiver object to the lambda
return html
}
html { // lambda with receiver begins here
body() // calling a method on the receiver object
}
我不知道如何写在斯卡拉这个代码?如何在接收器中声明scala函数类型?