Kotlin M2 Candidate

It’s been seven weeks since Kotlin M1 release, and I’m happy to invite you to try out a candidate build of Kotlin M2! This post gives an overview of the upcoming milestone release along with come usage instructions.

Amazing work! Thanks for all the hard work to all the Kotlin team. Javascript and Android improvements in this milestone are big steps.

I tried running the Android sample, which worked, but still have not succeeded in using the kotlinAndroidLib (when I add an activity with AndroidManifest and layout.xml to this project I get [INSTALL_FAILED_DEXOPT], and also when I tried it in another project, I got unresolved reference even though I included the necessary kt files. Anyway, I will ask about this in the forum.

Therefore the only feedback I have is perhaps to create troubleshooting tools for developers. I encountered situations in the past where I think I have everything configured correctly, yet I get “unresolved reference” or other errors that are hard to understand and troubleshoot.

As a side note, but his is one general frustration with very advanced environments like IntelliJ. Because it is a very complex tool, sometimes there are many things that need to be tweaked in various areas (project settings/system settings). On the other hand, command-line tools tend to be simpler to troubleshoot. Can something be created to help us troubleshoot things (a tool or or even a web page with troubleshooting steps)? I feel this may sometimes be overlooked by the IntelliJ development team because they are intimately familiar with IntelliJ so the solutions may seem obvious to them, but for the average user it is not obvious.

I’d like to suggest a feature for Kotlin.
In a nutshell, it would be nice to have a way to express complex object literals in Kotlin, and it could be a language of its own.
Just like JSON is a subset of javascript, there could be a really small subset of Kotlin. It could be used in configuration files, message payloads, etc. But more usable than JSON, and with organic integration with Kotlin.
You can take a look at my project on github: https://github.com/semicontinuity/lepton – tried to do something like that few years ago, for java.

And yes, there are builders, but I don’t like them. And object literals, described using builders, are embedded in the code. One cannot load them from a resource, like XML. It is tempting to add code into it.
With the special Literals language, only declarative constructs should be allowed, not any kind of code.
Also, for me builders just feel unnatural, cryptic and fragile, and requiring to think, why the structure of something is specified with e.g. closures, that are normally used for something very different.
I’d prefer to use the syntax that was designed specifically to express my intentions, not abused for other purposes. Since Kotlin is a new language, created from scratch, it could provide something better than builders.

I’ve written some builders in grooovy, and disliked the fact that quite a lot of glue code has to be written.
In Kotlin, it looks the same…
A lot of code just to be able to use builders syntax. And that code has no value by itself…
For Instance, I like JAXB to convert JSON or XML to java objects. Not that it’s perfect, but no glue code… And to write by hand the code to support builders – for me it’s a step back.

Inline functions have different semantics than control structures, but the same syntax. For example:while (x < 10) { x++ }
would have a different meaning if while() was an inline function.

I don’t mean this to bash the concept… I really like the potential of inline functions to cut down boilerplate code. But, I wonder if there’s a more powerful form of metaprogramming lurking in the concept there somewhere.

“while” is a keyword, no function can be called “while”, same for other built-in control structures.
The only ways in which inline functions are more powerful than normal functions are
1. non-local returns and jumps.
2. dataflow analysis can look into their bodies.
This is not a huge difference. The main point of inlining is performance.