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

Like this? Share it with your network

Share

JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation

on

  • 1,435 views

 

Statistics

Views

Total Views
1,435
Views on SlideShare
1,435
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 Presentation Transcript

  • 1. Kotlin: How Things Work Practical Aspects of JVM Language Implementation Andrey BreslavTuesday, October 2, 12
  • 2. 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
  • 3. tetris is way too easy when played this way 3Tuesday, October 2, 12
  • 4. 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
  • 5. About Me • Project lead of Kotlin ➡ at JetBrains since 2010 (not (RICH HICKEY)) • EG member of JSR-335 ➡ Project Lambda 5Tuesday, October 2, 12
  • 6. Kotlin Modern Language for Industry • Smart compiler • Static typing ➡ Less boilerplate • Readability • Flexible abstractions • Tool support ➡ Powerful libraries • Interoperability 6Tuesday, October 2, 12
  • 7. Outline • Extensions • Bridges of All Sorts • Types: Collections and Nulls • Dreams... (maybe) 7Tuesday, October 2, 12
  • 8. Extensions • Live Demo ➡ Extension syntax ➡ How it is compiled ➡ Multiple files in a package 8Tuesday, October 2, 12
  • 9. Bridges 9Tuesday, October 2, 12
  • 10. 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
  • 11. Kotlin Brides & Primitives Java 1 1 & Kotlin Kotlin foo(t: T) = t foo(t: Int) = t 1 1 11Tuesday, October 2, 12
  • 12. Default Arguments 12Tuesday, October 2, 12
  • 13. 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
  • 14. Traits: Code in Interfaces class Trait$Impl { static foo()V { println("Hi") } } 14Tuesday, October 2, 12
  • 15. Trait Hierarchy T1 foo() { println() } T2 foo() { T1$Impl.foo() } C foo() { T2$Impl.foo() } 15Tuesday, October 2, 12
  • 16. Summary • Sometimes you need just one more method... 16Tuesday, October 2, 12
  • 17. Collections How Data-Compatible is Your Language?Tuesday, October 2, 12
  • 18. Collections & Variance Java: Kotlin: 18Tuesday, October 2, 12
  • 19. Kotlins Collections 19Tuesday, October 2, 12
  • 20. Declaration-Site Variance 20Tuesday, October 2, 12
  • 21. Translation Ø java.util.List 21Tuesday, October 2, 12
  • 22. Translation: Inheritance 22Tuesday, October 2, 12
  • 23. Translation: Variance 23Tuesday, October 2, 12
  • 24. Calling Java From Kotlin 24Tuesday, October 2, 12
  • 25. Summary • Kotlins collections ➡ Better than Javas ➡ Still Compatible 25Tuesday, October 2, 12
  • 26. Nullable TypesTuesday, October 2, 12
  • 27. Demo • Kotlin is null-safe • Java code can be annotated for safe access 27Tuesday, October 2, 12
  • 28. Talk Summary • Languages are about tradeoffs • Kotlin is cool :) 28Tuesday, October 2, 12
  • 29. 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