Var and val? Are you kidding me? Give me con

var and val suck as names for the two core types. Please alias val as con. There is a significant usability difference as in keyword sparse languages an IDE with reasonable configurations can emit a unique pair within 2 keystrokes (first letter, enter) and zero decision points. Those keystrokes are on different hands. This is trivially a single action. Hit the right first letter and enter.

If I am defining a variable in kotlin? I am required to either press 4 individual keys or 3 with a decision point. This isn’t bad but it seriously grates me. I’m already learning a language that has serious code structure changes and I’m supposed to be squinting at a computer screen to figure out why it wants my var to be a var. I bet you didn’t even notice that I put the same token there twice.

Should I put on my dyslexia font for code? The font that literally works by making the font subtly slower to read? Are people with disabilities not your target audience?

What am I supposed to read into this choice? There has to be a reason. If there isn’t, is there a diff I can put into the compiler for this?

Cheers.

While I agree with you that considering disablities val and var maybe aren’t the best choice and something else might have been better this can’t really be changed since kotlin is stable. Maybe in a 2.0 release, but even that might be impossible.
Also there is a really long topic about this (with pretty much the same arguments as yours) here.
I suggest reading through it, maybe you have some more points to add. People suggested adjusting your IDE settings to highlight the difference between val and var in the code more. Not sure about the key strokes but I this should be possible with live templates. Just create them for val and var. If you call them v(var) and l(val) or whatever you can just type v to expand var and l and expand to val.

Man - at the core of it is just this. It’s not in the compiling stage. It’s in the tokenizing stage. Just point me at that and the documentation there. It just needs to be an alias. That that could be classified ‘impossible’ boggles my mind and I am just kind of venting. But still.

Damn - a language with so many positives to push good coding habit can’t make one constant an array? Did you ever hear the tragedy of Darth Kotlin The Wise?

They could save others from bad coding habits, but not themselves. Ironic.

The reason it’s impossible to change is not because of any technical difficulty, but because Kotlin has been declared “stable” and there are large volumes of production code in the field that would break if something like this was changed (any reasonable short alias you could pick has a high probability of being used for something else already in someone’s production code).

It’s unfortunate; I would have preferred something different myself (let seems to be pretty common across multiple languages) but there’s not much to be done about it. Syntax highlighting and live templates are probably the way to go.

I personally have no problem distinguishing var and val (though I completely understand those who do); my gripe just comes from there being existing keywords in the industry that could have been used for this and that were perfectly good (such as let) so why make something new. (On the plus side, if you as a developer default to val for all your variables and only change to var when mutability is really needed, it does mean only one letter to change — small consolation, I know).

Most of these issues are easily solved in the IDE, without breaking any existing code, which is why I doubt this will ever change.

Wel cor blimey if there’s no technical reason and they consider it stable, well, I suppose that means a fork likely wouldn’t be some crazy maintenance. I’ll put it on my TODO.