Are there any technical reasons why inside of (), ...
# getting-started
r
Are there any technical reasons why inside of (), line breaks can’t imply commas, similar how inside {}, line breaks imply semicolons?
v
Just guessing, but probably because it would be majorly confusing for most readers and a syntax interpretation nightmare.
1
r
But with programming style shifting from the imperative “a semicolon at the end of each line” to a more functional “either a dot at the start of the line, or a comma at the end”, I feel like Kotlin leaving out semicolons doesn’t get us as much as leaving out all those commas would. People got used to no longer seeing semicolons everywhere, so I’d assume they could also get used to skipping commas at the end of lines.
v
People could also get used to disallowing newline characters and having each class in only one single line. It would still be horrible for readability and most people would not want to adapt to it but just leave the language behind. And I said it is probably also a syntax interpretation nightmare.
But as I said, just guessing here. Feel free to open a feature request to the language committee for being able to leave out commas. 🙂
e
Copy code
f(
  a,
  to,
  b
)
currently has a different meaning than
Copy code
f(
  a
  to
  b
)
not necessarily insurmountable but it would be an incompatible change
r
@ephemient My IntelliJ complains about having that
to
on a single line like that, no matter whether it’s in {} or ().
e
I haven't opened the IDE but if that doesn't work then the KTIJ plugin is wrong
r
@ephemient Interesting, it autoformats it like this on paste:
Copy code
fun main() {
        println(
            "hello"
                to
                "world"
        )
    }
… but manually changing it back to what you linked works, but it breaks the syntax highlighting.
So yeah, looks like it would be a breaking change then. Unless you check for infix operators I guess.