Vararg vs. array parameter

  1. vararg is passed as array anyway, there’s nothing to fear about stack issues or poor performance.

  2. I’m not sure why do you think it’s ugly. If you’re passing an array as a multiple parameters, semantically it’s very different case and it’s good to have a dedicated syntax for that. Also there are issues when compiler can’t understand, whether you’re passing a spreaded arguments or just an array as one argument, they are real issues in Java and Kotlin solves this ambiguous situation.

4 Likes