https://kotlinlang.org logo
Title
q

qwert_ukg

08/29/2018, 8:01 PM
How i can make a shortcut for `lazy`:
val __name: String by lazy {
     createHTML().small {
         +name
     }
}
like as my own delegate builder `html`:
val __name: String by html {
    small {
        +name
    }
}
o

orangy

08/29/2018, 8:28 PM
what do you mean by a shortcut?
q

qwert_ukg

08/29/2018, 8:30 PM
i mean just a shortest code length. Wraper
o

orangy

08/29/2018, 8:35 PM
what’s wrong with
fun html(…) = lazy {…}
q

qwert_ukg

08/29/2018, 8:59 PM
coze i don't know how to call
init
extension lambda, directly on
createHTML
function. I have only this:
fun html(init: FlowContent.() -> Unit) = lazy { createHTML().div { init() } }
I know, return type of
createHTML()
is not
FlowContent
thats all my html content declared into
html
builder, wraped by
div
🙂... Try to find right way
o

orangy

08/29/2018, 9:20 PM
.apply(init)
?
or, for
div
, just pass it directly to the
div
function