JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
Upcoming SlideShare
Loading in...5
×
 

JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation

on

  • 1,373 views

 

Statistics

Views

Total Views
1,373
Views on SlideShare
1,373
Embed Views
0

Actions

Likes
1
Downloads
16
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation Presentation Transcript

  • 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