<@U0BHS1Y07> Yes, I want to use collection literal...
# random
d
@voddan Yes, I want to use collection literals in Kotlin. It’s something that I miss greatly coming from Swift, and something that I repeatedly search for month after month hoping to hear news of developments. Lack of literals does not prevent us solving problems; but to be honest, the current way feels unneccessarily verbose and ‘Java like’. It does not feel in the spirit of Kotlin. It’s not a great problem, but it feels like something that shouldn’t be too complex to implement while enhancing the readability, writeability and ‘modern feel’ of the language.
1
v
current way feels .. ‘Java like’.
This is arguably a good thing 😆
Did I understand you right that your primary reason for wanting the literals is that you are used to them from Swift?
d
@voddan I take your point about ‘Java like’ being potentially a good thing, but I don’t think it’s fair to say my desire for them is only to do with Swift.
Many modern languages are including collection literals as a feature.
There’s a reason for that.
v
One reason I see is that "other langs have it, why don't we"
d
Ultimately it just boils down to ‘it’s shorter to write, everyone understands it'
Thats a good enough reason
v
Ow, sorry if it looked like that
No point is meaningless
d
No it’s ok, my bad.
But yes, I think at the core, it just comes down to ‘it is slightly more convenient, and a well recognised syntax, even between many languages of the day'
👍 1
I agree with your assessment that it doesn’t jump out as a high priority.
Probably a nice to have.
v
Hah, I've been typing so long that you've answered everything I wanted to ask 😄
d
🙂
v
My point of view is that other languages are different from Kotlin and had a different motivation to include literals
That's the reason I don't like the "being modern" argument
d
Well, I don’t have a full view of Kotlins design goals and trajectory
so I am fully prepared to accept it may not be the best course of action.
v
Nobody does
But ideally a feature must be formed by a need inside the language, don't you agree?
d
Definition of ‘need’ is interesting though.
We didn’t ‘need’ to remove explicit mention of types throughout code.
Type inference is a big convenience.
Collection literals probably a little further down the spectrum of convenience.
I suppose it comes down to a question of whether there are higher priorities in the language. As a developer, I’m at an early stage with Kotlin; I can say that collection literals are something I miss from Swift, and note they are present in other languages, with a very similar, near-universally understood syntax. That’s probably about as useful as this ‘data point’ can be 🙂
Good luck with the investigation.