According to the spec <https://jetbrains.github.io...
# announcements
e
According to the spec https://jetbrains.github.io/kotlin-spec/, escape-identifier-character can be “any input-character except backtick.”
Copy code
fun `[`() {}
won’t compile, though. I have found that forward slashes (
/
), backslashes (
\
), open brackets (
[
), and closed brackets (
]
) are not allowed in backticks. Is this a bug in the documentation, or am I missing something?
d
The documentation is correct, but definitely needs some clarification -- the Kotlin language itself can support any name you like, but not on every platform. You still have to respect the limitations put on symbol names by the target platform. For JVM, slashes, square brackets, and angle brackets are not allowed. Android has some more restrictions, like spaces, which are also forbidden. More information here: https://blogs.oracle.com/jrose/symbolic-freedom-in-the-vm