Kotlin 1.4 Online Event
Tags: events, event, kotlin, mobile
Published: 2020-12-07 09:40:35

---
title: Kotlin 1.4 Online Event
published: true
date: 2020-10-29 08:00:17 UTC
tags: Events,event,Kotlin,mobile
canonical_url: https://apiumhub.com/tech-blog-barcelona/kotlin-online-event/
---

Recently, the Kotlin Online Event organized by Jetbrains was held to discuss the latest version of the language and also to replace what in principle and under normal circumstances would have been the KotlinConf that has been postponed for next year.

The event took place over 4 days with short lectures, usually less than 30 minutes, and lectures were grouped according to their subject matter, each day dedicated to a different aspect. All the conferences were concentrated in the afternoon, which was a great success.

For this event, unlike other 100% online events, they opted to pre-record the conferences in order to obtain a more controlled result and avoid problems associated with live events. The conference was always accompanied by a space of 10 minutes dedicated to questions and answers. Besides, some of the conferences had an extra set of tests to check what was learned, even with the option of winning prizes. Although I personally did not use this element I think it is interesting and a good initiative.

The conferences were grouped as follows:

Day 1: General Overview  
 Day 2: Kotlin Libraries.  
 Day 3: Kotlin everywhere: Android, KMM, JS.  
 Day 4: Server-side Kotlin.

## **Day 1**

The first talk was aimed to present the most important topics that would be discussed throughout the event, making reference to the subsequent talks.

The main topics discussed were:

- The progress and current status of the new Kotlin compiler with a 4.5 times faster frontend.
- The improvements in the type inference system with which they have fixed more than 300 issues.
- Plans to support new features in Java 14 and Java 15.
- Kotless a framework for serverless backends.
- Kotlin multiplatform and its libraries for concurrency, serialization and dates.
- The improvements in file size with the new compiler in KotlinJS. 
- Future plans for WebAssembly.
- The current status (beta) and improvement plans for KMM (Kotlin multiplatform mobile). 

The next conference focused on the Kotlin community and how to contribute to the project. Sharing statistics and usage, using early-access-programs (EAP), reporting problems or incompatibilities through YouTrack are some of the things that help improve and evolve the ecosystem.

Next came the talk “New Language Features in Kotlin 1.4” where the new language features in the latest version were discussed.

- _SAM_ (single abstract methods). This allows us to pass a lambda when a method receives by parameter an interface with a single method. This feature was already available with interfaces defined in Java and now we can do the same with interfaces defined in Kotlin with the following syntax: **fun interface Action {}**

- _Explicit mode_ is a validation process that we can activate from gradle that was meant for libraries creators and that allows to verify a set of recommendations: methods visibility, specifying return and so on.

- _Trailing commas_. It allows to put a comma “,” at the end of a list of arguments, function declaration or class declaration (constructor).

- _Break and continue_ within when. Unlike the previous version, Kotlin 1.4 allows the use of _continue_ within a _when _expression.

- Mix of positional arguments and named arguments.

```
drawRectangle(
    width = 10, height = 20, color = Color.BLUE
)


drawRectangle(
    width = 10, height = 20, Color.BLUE
)

```

- Improved type inference systems.

- Unification of exceptions for nulls. In previous versions of Kotlin, depending on the context, different exceptions related to null could be launched. Now it has been unified in a single exception with the intention of being able to optimize certain checks at the compiler level, in the near future. 

The penultimate conference of the day was focused on the improvements made to the IDEs and the use of Kotlin. Improvements in auto-completion and code indexing among other things. 

For further information: [https://www.youtube.com/watch?v=-5ZjMwNzWrk](https://www.youtube.com/watch?v=-5ZjMwNzWrk)

## **The talk that aroused the most interest**

To finish we had what I would personally categorize as the highlight of the day and perhaps of the event. These are the next features of Kotlin.

Under the name “A look into the Future” Roman Elizarov brings together the most important themes that are about to come in the language, but first briefly reviewing the language milestones or key points on a historical level. The first version, the appearance of the coroutines, the compatibility with Javascript, Kotlin/Native etc.

In the near future, interoperability with more modern versions of Java will be enhanced to be able to use its Sealed Classes version and the Records (in essence very similar to a Kotlin data class).

For the more distant future they are focusing on the following ideas:

- _Companion namespaces_: through a new keyword it would be possible to encapsulate variables (constants for example) or functions within the same concept without it representing a particular type. This new element could also be applied to the Kotlin extensions, _namespace extensions_.

![](https://apiumhub.com/wp-content/uploads/2017/03/Captura-de-pantalla-2020-10-28-a-las-15.38.02-300x83.png)

 

 

- _Multiple receivers_: this feature would allow us to create an extension whose body has access to more than one context, that is, the extension is from two types at once. For this, a final syntax has not been defined yet, but they are working with the idea of using decorators. _Decorator_ would be one more keyword of the language that could be added to a function and then, as an annotation (@), used in other functions. In the following example, taken from the presentation, we see that we use a @with annotation that is actually a decorator we have created. This decorator could also be an extension function on View and by using it on another extension allows us to have the two “contexts” in the body of the second extension.

![](https://apiumhub.com/wp-content/uploads/2017/03/Captura-de-pantalla-2020-10-28-a-las-15.36.08-1024x117.png)

 

 

This functionality is not only focused on the extension functions but with the decorators could simplify other situations.

- Another new feature is to have different visibility for the same property (_getters_ and _setters_). This in Android, would simplify the code we normally write to “hide” the mutable version of a _LiveData_ to consumers.

![](https://apiumhub.com/wp-content/uploads/2017/03/Captura-de-pantalla-2020-10-28-a-las-15.36.29-300x44.png)

 

 

- Finally, they are working on a syntax that would allow us to work with an immutable model but with the easy manipulation of a mutable structure.

![](https://apiumhub.com/wp-content/uploads/2017/03/Captura-de-pantalla-2020-10-28-a-las-15.36.46-300x86.png)

 

 

With this we would avoid having to make a .copy() every time we want to modify some value.

![](https://apiumhub.com/wp-content/uploads/2017/03/Captura-de-pantalla-2020-10-28-a-las-15.37.03-300x60.png)

 

 

This new keyword would unify the inline classes as otherwise there would be compatibility problems with [Valhala](https://wiki.openjdk.java.net/display/valhalla/Main) project. So an _inline class_ would become a _value class_ with an annotation that would indicate to the compiler that it can be simplified to a primitive type (this annotation is not yet defined). 

## Day 2

The second day focused on the Kotlin libraries.

At the beginning, it was coroutines turn where they focused on the debugger improvements and the new APIs recently added. _ShareFlow_ and _StateFlow._

The next talk focused on the serialization library and its first stable version. [Kotlinx.Serialization](https://github.com/Kotlin/kotlinx.serialization) is a multiplatform library that we can use in JVM, Native and JS.

In addition, a new library for date management, [Kotlinx.Date-Time](https://github.com/Kotlin/kotlinx-datetime) was also presented in another talk.  This is another cross-platform library that uses java.time for JVM, js-joda for Javascript and ThreeTen for native.

Apart from these talks there was also one focused on the new APIs added in the Kotlin standard library (stlib).

## Day 3

Third day was focused on the use of Kotlin in frontend/mobile environments.

The first talk by Florina Muntenescu (from Google) focused on the initiatives of the Android team to maximize the virtues of Kotlin.

One example is Jetpack Compose, a library written entirely in Kotlin and whose dependence on the new compiler means that the two companies are working closely together. Apart from this library we also see that integration with coroutines is extended in all possible libraries: Room, Paging, DataStore…

Then we had two talks focused on KMM with a KotlinJS talk between these two. The first of the two KMM or Kotlin Multiplatform Mobile talks had a more introductory approach.

On the other hand, the KotlinJS talk was all about the improvements that the latest version of Kotlin has brought: interoperability with packages distributed by NPM and the generation of static definitions with the Dukat project that is still in an experimental phase.

Besides this, we have available the first version of [kotlinx-nodejs](https://github.com/Kotlin/kotlinx-nodejs) that will allow us to make use of the node APIs from Kotlin.

With the arrival of the new compiler they hope to reduce the final size of JS code by using _tree shaking_ through webpack, improve compatibility with Typescript and be able to use a Kotlin library in Typescript and vice versa. 

To be able to test the new compiler we only have to add the following line to the gradles properties file.

```
kotlin.js.compiler=ir

```

## Day 4

Finally, the fourth day was dedicated to backend development with Kotlin.

Talks about:

- Ktor: [https://www.youtube.com/watch?v=Ga\_jUBj-sK0](https://www.youtube.com/watch?v=Ga_jUBj-sK0)
- Spring: [https://www.youtube.com/watch?v=dSIIZastK58](https://www.youtube.com/watch?v=dSIIZastK58)
- Kotless: [https://www.youtube.com/watch?v=S5sB1qHpRPQ](https://www.youtube.com/watch?v=S5sB1qHpRPQ)

## Conclusion

In my opinion, the highlight of this event was concentrated on the first day through the talk on the future of the language, which is why I have extended a bit more on that one. I find very interesting the direction the language is taking with new proposals and I look forward to seeing how they evolve (decorators, _value-based class_, namespaces).

The new compiler is a project that has been in progress for some time but whose repercussions deserve all the caution, and the advances shown indicate that we are close to a final version.

The initiatives in the “mobile” world do not fall short and it seems that KMM will be a project with a great future.

Now we just have to wait to see what Kotlin version 1.5 will bring.

The post [Kotlin 1.4 Online Event](https://apiumhub.com/tech-blog-barcelona/kotlin-online-event/) appeared first on [Apiumhub](https://apiumhub.com).