I'm confused by a paragraph in the <documentation ...
# getting-started
k
I'm confused by a paragraph in the documentation on functional interfaces:
```fun interface Printer {
fun print()
}```
Its constructor will be created implicitly, and any code using the
::Printer
function reference will compile. For example:
Copy code
documentsStorage.addPrinter(::Printer)
On this page, the
addPrinter
function is not mentioned anywhere. What would its parameter type be, and how would it be used?
y
probably:
Copy code
fun DocumentsStorage.addPrinter(printer: (() -> Unit) -> Printer)
Not sure how useful it really is to be honest.
For type-related questions btw, you can write some of the code in Idea, and then Ctrl+Shift+P on it to see its type
e
given that the code above it has
Copy code
fun Printer(block: () -> Unit): Printer
that is the declaration
::Printer
was referencing previously, and the docs say that works with
fun interface
and no additional function instead
k
I see, thanks