Programming language: Kotlin 1.4.20 is dynamic and fault-tolerant

Source: Heise.de added 23rd Nov 2020

  • programming-language:-kotlin-14.20-is-dynamic-and-fault-tolerant

JetBrains has released version 1.4. 20 of the Kotlin programming language. The release brings numerous changes under the hood, which mainly relate to the variants for JavaScript and the Java Virtual Machine (JVM).

As expected, there are no syntactic changes compared to version 1.4 released in August. Kotlin differentiates between feature releases according to the scheme 1.x with major changes to the programming language and incremental releases 1.xy, which bring innovations in the tool chain, in terms of performance or internal implementation. The value for y increases regularly in steps of ten, a unit as 1.x.yz marks a pure bugfix release.

More dynamic methods for the JVM In interaction with the JVM, Kotlin now relies on dynamic method invocations when concatenating character strings, just like Java 9, using the invokedynamic – statement in the bytecode. The procedure should on the one hand be faster and on the other hand create room for future optimizations without changes to the bytecode.

In Kotlin 1.4. 20 the functionality is marked as experimental. Developers must activate it explicitly via the compiler option – Xstring-concat . It also works for concatenations using the plus operator a + b and for connections using the explicit method call a.plus (b) or referencing with (a :: plus) (b) . It also applies to the toString method in conjunction with inline and data classes as well as for most string templates.

Fault-tolerant JavaScript compiler The current release has numerous innovations on board for the connection to JavaScript via Kotlin / JS. The interesting one should be a new option, with which the toolchain ignores errors during compilation in order to try out the rest of the code anyway. The documentation mentions the refactoring of the code as application scenarios, in which the error messages relate to a part of the program that is not related to the one currently being processed.

The compiler can choose to ignore all errors or only semantic ones. For the latter, compilation still fails in the event of syntax errors, but the compiler waves semantically incorrect constructs such as the incorrect type assignment in val x: String = 3 through.

The compiler option – Xerror-tolerance-policy = {SEMANTIC | SYNTAX} , which can be integrated directly into the Gradle script. The option SEMANTIC only ignores semantic errors, while compiling with the SYNTAX – Option continues even if there are syntax errors.

kotlin { js (IR) {compilations.all {compileKotlinTask.kotlinOptions.freeCompilerArgs + = listOf (“- Xerror-tolerance-policy = SYNTAX”)}}} Individual adaptation and templates off the shelf Ignoring the errors by the compiler is also marked as experimental, as are some other additions to Kotlin / JS, including the possibility of creating individual entries for the creation of package.json to be entered in the Gradle script. Developers can use the customField function in the packageJson – Use block.

Kotlin 1.4. 20 also brings three templates for Kotlin / JS, which provide the basis for different JavaScript target platforms: Browser Application targets conventional JavaScript applications that run in the browser, React Application contains the necessary modules including Kotlin wrappers to create a React application, and Node.js Application serves as the basis for the interaction with Node.js.

JetBrains originally sent the programming language into the running as an alternative to Java. In the beginning, the language was also limited to the JVM. It has started a triumphant advance on Android in particular since Google officially included it 2017 as an alternative to Java in Android Studio . In the meantime, however, the programming language has been designed for various platforms: Kotlin / Native enables execution without a virtual machine, especially to cover platforms such as iOS that do not have a JVM on board.

With Kotlin / JS is also linked to JavaScript, and since Kotlin 1.2, multi-platform projects can be created that cover JVM and JavaScript with a code base. The language of an island off St. Petersburg owes its name, which in this country likes to attract trolls in forums. The JetBrains team there was initially responsible for developing the language.

Further innovations in Version 1.4. 20 of the programming language such as the optional packaging of Objective-C exceptions in Kotlin exceptions for Kotlin / Native im Interaction with iOS applications can be found in the Kotlin blog. The current release can be installed directly from the IntelliJ IDEA and Android Studio development environments. It’s also available through Kotlin’s GitHub repository, which also shows the full list of changes in the changelog.

(rme)

Read the full article at Heise.de

brands: Google  InLine  RME  
media: Heise.de  
keywords: Android  Google  IOS  

Related posts


Notice: Undefined variable: all_related in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 88

Notice: Undefined variable: all_related in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 88

Related Products



Notice: Undefined variable: all_related in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 91

Warning: Invalid argument supplied for foreach() in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 91