Gradle Kotlin: build.gradle.kts with cpp-application plugin

The build.gradle.kts file looks like this…

plugins {
    id ("cpp-application" )
    id("maven-publish" )

group = ""
version = "2019.3"

application {
    baseName = "main"

I get the errors …

  Line 12:     baseName = "main"
               ^ Val cannot be reassigned

  Line 12:     baseName = "main"
                          ^ Type mismatch: inferred type is String but Property<String!>! was expected

And sure enough the application.baseName is a Kotlin val .
My question is why can baseName be assigned/overrwritten in Groovy but not Kotlin?

Of course leaving baseName with its default value matching the project name is fine so this is not a big deal here.

I figured it out. The application.baseName is not a String but a Propery.
It is a type of wrapper so the content can be set as follows:

 application {
       baseName.value( "main" )

Apparently groovy does this auto-magically.