This is another heads-up and a call for feedback. We have been discussing options regarding Kotlin’s annotation syntax for quite some time already, rolling out experiments, gathering feedback. As we are finalizing the language now, many pain points that we used to postpone are surfacing. We have to make decisions, and sometimes in a defensive way. In this post I will give an overview of the options we have and the decisions we are provisioning.
Setting the stage: Some introductory definitions
Kotlin (as well as many other languages) has two kinds of metadata:
- modifiers (such as
abstract), which are built into the language, and
- annotations (such as
@Inject), which are defined in libraries, also they can have parameters.
Unlike many languages, in Kotlin most modifiers are not proper keywords. They have special meaning only where they are applicable, i.e. in front of a declaration. The compiler won’t mind if you call your variable or class
val public = "PUBLIC!"
This technique is known as “soft keywords” or “contextual keywords”. Continue reading
We are currently working on improving compilation times. Today we are happy to invite you to try Kotlin
0.12.1230 making use of the Gradle Daemon. It eliminates startup costs, and your builds run faster. Continue reading
Kotlin has had top-level functions and properties from day one. They are very convenient in many cases: from basic utilities to extensions for standard APIs.
But Kotlin code is not the only client, and today I’m going to explain how we are planning to improve on the Java interop when it comes to calling top-level functions and properties. Continue reading
kapt, an Annotation Processing Tool for Kotlin, some time ago, and discussed its limitations. Now most of the limitations are going away with the updated version of
kapt that is available as a
0.1-SNAPSHOT preview. Continue reading
Kotlin is undergoing finalization, and as part of the process we are cleaning up: revising the language and its libraries. The biggest changes have been made in M12, but some more are coming. The point is to perform all the necessary breaking changes before we release 1.0, so that we can keep the language and libraries backwards-compatible after the release.
The trick is both we, ourselves, and you, our users, have quite a bit of code written in Kotlin already, and we don’t want all that code broken hopelessly on each update (some breakages are inevitable, unfortunately, but we are doing our best). The general scheme of making changes in a user-friendly way is “deprecate-release-remove”, for example:
- in M12 we deprecated quite a few language constructs and library classes/functions,
- then we released M12, so that whenever you use those to-be-removed language and library features, the compiler issues warnings,
- in the next milestone we will remove those deprecated things completely, so that the compiler will issue errors instead of warnings.
So, if you have any deprecation warnings in your code, now is just the right time to get rid of them: the next major update will make all that code red, and your build will break.
Getting rid of deprecation warnings
As mentioned above, there are two kinds of deprecation warnings: language deprecations and library deprecations. To get rid of them we provide several options.
Kotlin Eclipse Plugin 0.2.0
Today we are happy to present a new version of Kotlin plugin for Eclipse. This release includes the following features:
- Update to Kotlin M12
- Java to Kotlin converter
- Navigation to Kotlin sources from Java
- Kotlin syntax highlighting in Compare View
In the previous post we mentioned that the Quasar library now supports Kotlin, providing awesome support for fibers (lightweight threads), Go-like channels, Erlang-like actors, and other asynchronous tools.
Our friends from Parallel Universe have published a blog post that dives into details of using Quasar with Kotlin. Even in the unlikely case that multithreading doesn’t concern you much, Quasar/Kotlin integration is a great example of a “DSL” library written in Kotlin, it uses
- data classes
- top-level functions
- annotated expressions
- inline functions
to build a natural-looking and efficient API, and the blog post explains it very well.
We are happy to present Kotlin M12, bringing some rather important changes and new features:
- New syntax for annotations and enums
- More convenient semantics of function types
- Better smart casts
kapt for Java Annotation Processing support
- Multiple IDE features
- and more…
As there have been many requests to support Java Annotation Processing, we are working on it, and first results are ready for preview. This is the call for early feedback. Continue reading
Last week we published a new version of Anko. While the main purpose of this library is creating layouts though a DSL, even the users of XML layouts can benefit from it. Today we are going to talk about such “ambivalent” features of Anko. Continue reading