This works but forces name to have a default value...
# announcements
s
This works but forces name to have a default value, causing it to be var. An empty string can workaround nullable type but is there a better way?
Copy code
data class Processor ( var name : String ?= null )
fun processor( block : Processor.() -> Unit ) : Processor = Processor().apply{ block() }

fun main( argv : Array<String> ) {
    processor {
        name = "Qualcomm"
    }
}