Difference between fun calls


#1

I am completely new at Kotlin and I am trying to understand how a DSL is made. While reading https://kotlinlang.org/docs/reference/type-safe-builders.html I ran into this fun definition:

fun html(init: HTML.() -> Unit) { … }

What is the . in HTML.() signifying? that the variable init must be a member/child of HTML?

Ron


#2

This means that in the body of the lambda passed as a parameter to the html() function you can invoke methods of the HTML class without any extra qualification.