Kotlin, Unresolved reference: implementation, why double qoutes fix it?

why when converting to kotlin, the keyword implementation should be in double quotes, e.g. for terasology’s gestalt libary, in this pull request

in the pull request the file is still groovy, so no double quotes. with double quotes it works with kotlin

dependencies {
    "implementation"(project(":gestalt-util"))
...
}

while this does not - but to be honest, i d prefer without double quotes.

dependencies {
    implementation(project(":gestalt-util"))
...
}

the error message would be: Unresolved reference: implementation

Well, one of the advantages of Kotlin DSL is, that it is type-safe and that you get amazingly better IDE support.

The implementation you try to use there is a configuration. If it does not work without quotes, that means you did not apply and plugin in the plugins { ... } block that adds this configuration. Only things that are added by plugins in the plugins { ... } block without condition hat those type-safe accessors as Gradle is pretty sure they will be available at runtime. If you for example remove that plugin that adds it, compilation of the script already fails, not only at runtime.

My using the quotes you say “I know better than you, it will be available” and instead get a runtime error if it is not found.

That the string-version works is most probably a sign that you either use the legacy way to apply plugins, using apply, it that you use highly discouraged cross-project configuration like allprojects { ... }, subprojects { ... }, project(...) { ... }, or similar, which you all should avoid to use.