https://kotlinlang.org logo
#announcements
Title
# announcements
r

redrield

06/27/2017, 7:51 PM
If you're gonna add something, don't go halfway 🙄
r

Ruckus

06/27/2017, 7:55 PM
redrield: You could say the same thing about operator overloading in Kotlin not letting you define your own operators. Or you could say that JB does a lot of research into the intended scope of a feature and implements it accordingly.
I find the latter to be true 🙂
r

redrield

06/27/2017, 7:55 PM
I'd say the 2 scenarios are different
Allowing people to define custom operators as they please would clutter code and would give a vibe similar to scala
Limiting people makes sense
but this isn't making something that can be "abused" in that way
This is just making a nicer way to create collections
Like making matrices in Kotlin is piss ugly at the moment
arrayOf(arrayOf(0.0, 0.0), arrayOf(0.0))
r

Ruckus

06/27/2017, 7:59 PM
I don't think the scenarios are that different, and if making matrices is an issue you run into often enough to be annoying, you should create functions to do it for you.
r

redrield

06/27/2017, 8:00 PM
The scenarios are way different. This isn't something that would allow people to pollute their code with annotations who's purpose isn't immediately obvious (like
|~>
or whatever else scala programmers have come up with). this is just a more compact way to do something
I don't see the problem with having that available throughout the language
r

Ruckus

06/27/2017, 8:05 PM
"a more compact way of doing something" is exactly what custom operators are. Really, collection literals are custom operators for a commonly used feature. I'm not arguing for or against collection literals, I'm arguing against your claim that JB implemented this half way. I think they implemented them with a specific scope in mind and intentionally did not add them to the language as a whole.
The question of whether or not collection literals should be in the language is a much bigger issue that has many arguments for and against. (I tend to lean against them, but not strongly enough to really care.)
r

redrield

06/27/2017, 8:07 PM
I just think that collection literals were either #1 or very high up in the community poll (Can't remember off the top of my head), would be a bit annoying if they limit the scope of it
r

Ruckus

06/27/2017, 8:09 PM
I can't argue with that. I wonder who you would have to ask to get an explanation for why they did it this way and if they're planning to expand it to the whole language in the future.
2 Views