JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation

33 %
67 %
Information about JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
Technology

Published on October 5, 2012

Author: abreslav

Source: slideshare.net

Kotlin: How Things Work Practical Aspects of JVM Language Implementation Andrey BreslavTuesday, October 2, 12

Why you should care • Language is an abstraction ➡ thus it leaks abstraction • When something weird happens ➡ you may need to "see through the Matrix" 2Tuesday, October 2, 12

tetris is way too easy when played this way 3Tuesday, October 2, 12

JVM & Its Languages Whats i n... otl e , K possible? sur Clo vy, G roo , Sc ala Java t 1995 2012 4Tuesday, October 2, 12

About Me • Project lead of Kotlin ➡ at JetBrains since 2010 (not (RICH HICKEY)) • EG member of JSR-335 ➡ Project Lambda 5Tuesday, October 2, 12

Kotlin Modern Language for Industry • Smart compiler • Static typing ➡ Less boilerplate • Readability • Flexible abstractions • Tool support ➡ Powerful libraries • Interoperability 6Tuesday, October 2, 12

Outline • Extensions • Bridges of All Sorts • Types: Collections and Nulls • Dreams... (maybe) 7Tuesday, October 2, 12

Extensions • Live Demo ➡ Extension syntax ➡ How it is compiled ➡ Multiple files in a package 8Tuesday, October 2, 12

Bridges 9Tuesday, October 2, 12

Bridges for Generics (Lj/l/Object;)Lj/l/Object; overrides (I)I (Lj/l/Object;)Lj/l/Object; "synthetic bridge method" (JLS) 10Tuesday, October 2, 12

Kotlin Brides & Primitives Java 1 1 & Kotlin Kotlin foo(t: T) = t foo(t: Int) = t 1 1 11Tuesday, October 2, 12

Default Arguments 12Tuesday, October 2, 12

Masks for Defaults foo(a, b) foo(a, b, mask: Int) if (mask & 1) a = 0 if (mask & 2) b = 0 foo(a, b) 13Tuesday, October 2, 12

Traits: Code in Interfaces class Trait$Impl { static foo()V { println("Hi") } } 14Tuesday, October 2, 12

Trait Hierarchy T1 foo() { println() } T2 foo() { T1$Impl.foo() } C foo() { T2$Impl.foo() } 15Tuesday, October 2, 12

Summary • Sometimes you need just one more method... 16Tuesday, October 2, 12

Collections How Data-Compatible is Your Language?Tuesday, October 2, 12

Collections & Variance Java: Kotlin: 18Tuesday, October 2, 12

Kotlins Collections 19Tuesday, October 2, 12

Declaration-Site Variance 20Tuesday, October 2, 12

Translation Ø java.util.List 21Tuesday, October 2, 12

Translation: Inheritance 22Tuesday, October 2, 12

Translation: Variance 23Tuesday, October 2, 12

Calling Java From Kotlin 24Tuesday, October 2, 12

Summary • Kotlins collections ➡ Better than Javas ➡ Still Compatible 25Tuesday, October 2, 12

Nullable TypesTuesday, October 2, 12

Demo • Kotlin is null-safe • Java code can be annotated for safe access 27Tuesday, October 2, 12

Talk Summary • Languages are about tradeoffs • Kotlin is cool :) 28Tuesday, October 2, 12

Kotlin Resources • Docs: http://kotlin.jetbrains.org • Demo: http://kotlin-demo.jetbrains.com • Code: http://github.com/jetbrains/kotlin • Twitter: ➡ @project_kotlin ➡ @abreslav 29Tuesday, October 2, 12

Add a comment

Related presentations

Related pages

Kotlin: Practical Aspects of JVM Language Implementation ...

... Practical Aspects of JVM Language Implementation ... with Java that took place during work on the Kotlin programming language." ...
Read more

Kotlin - Data Classes - YouTube

See what data classes are and the value they provide. Feedback? Contact me at @hhariri.
Read more

更新网站 · cctanfujun/kotlin-web-site-cn@fd7aa4d ...

... "Kotlin: Practical Aspects of JVM Language Implementation ... net/abreslav/javaone2012-kotlin-practical-aspects-of-jvm-language ...
Read more

Classes and Inheritance - Kotlin Programming Language

Kotlin is a statically typed programming language for the JVM, ... Classes and Inheritance ... it from Kotlin (see Java Interop), and Aspect ...
Read more

List of JVM languages - Wikipedia, the free encyclopedia

JVM languages JVM implementations of existing languages ... E language has an implementation on the JVM; ... Kotlin, a statically-typed language from ...
Read more

Jvm Language | LinkedIn

Jvm Language Articles, experts, jobs, and more: get all the professional insights you need on LinkedIn
Read more

Language Implementation | LinkedIn

Language Implementation. Articles, experts, jobs, and more: get all the professional insights you need on LinkedIn. Sign up Get more personalized results ...
Read more

Andrey Breslav - Andrey Breslav - Google Sites

Andrey Breslav. If you are looking ... Kotlin and Java; JVM Language Summit 2012 (accepted), ... Kotlin: Practical Aspects of JVM Language Implementation ...
Read more