Hacker News new | past | comments | ask | show | jobs | submit login

While somewhat longer, you do have

    var map = hashMapOf("a" to 6, "b" to 12)
    var list = listOf(1, 2, 3)
This is still not Java-level verbosity.



I like that a lot, but the `to` syntax bugs me. Why not a colon, or Scala's `->`?


You type "->" faster and easier then "to"?


No, but it's visually clearer to me at a glance. It feels weird using letters, let alone full English words, to describe a mapping or anything else that I think a symbol is more suited for.

To me it would feel like assigning a variable with:

   a equals 6
   n equals "A"
Just feels icky, somehow.

Again, that wouldn't dissuade me from using the language whatsoever. It's only a minor irritation.


Because "to" isn't actually syntax at all. It's an infix function that creates a Pair. You can alt-click it in the IDE to go to the definition.


`->` in Scala is also just a method, but I think it's fair to call such things syntax even if they're not true "baked-in" language syntax.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: