Kotlin: How Things Work                           Practical Aspects of JVM Language                                      I...
Why you should care                     •   Language is an abstraction                         ➡   thus it leaks       abs...
tetris is way too easy                         when played this way                                   3Tuesday, October 2,...
JVM & Its Languages                                                                                Whats                  ...
About Me              •          Project lead of Kotlin                    ➡      at JetBrains since 2010                 ...
Kotlin                         Modern Language for Industry                         •    Smart compiler              •   S...
Outline                     • Extensions                     • Bridges of All Sorts                     • Types: Collectio...
Extensions                     • Live Demo                         ➡   Extension syntax                         ➡   How it...
Bridges                          9Tuesday, October 2, 12
Bridges for Generics                              (Lj/l/Object;)Lj/l/Object;                                              ...
Kotlin Brides & Primitives    Java                 1               1     &                                        Kotlin  ...
Default Arguments                            12Tuesday, October 2, 12
Masks for Defaults                         foo(a, b)   foo(a, b, mask: Int)                                       if (mask...
Traits: Code in Interfaces                                   class Trait$Impl {                                     static...
Trait Hierarchy                         T1   foo() { println() }                         T2   foo() { T1$Impl.foo() }     ...
Summary                     • Sometimes you need just one more                         method...                          ...
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                          ...
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                         ➡ ...
Nullable TypesTuesday, October 2, 12
Demo                     • Kotlin is null-safe                     • Java code can be annotated for safe                  ...
Talk Summary                     • Languages are about tradeoffs                     • Kotlin is cool :)                  ...
Kotlin Resources                 • Docs: http://kotlin.jetbrains.org                 • Demo: http://kotlin-demo.jetbrains....
Upcoming SlideShare
Loading in...5
×

JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation

1,378
-1

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,378
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation

  1. 1. Kotlin: How Things Work Practical Aspects of JVM Language Implementation Andrey BreslavTuesday, October 2, 12
  2. 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. 3. tetris is way too easy when played this way 3Tuesday, October 2, 12
  4. 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. 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. 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. 7. Outline • Extensions • Bridges of All Sorts • Types: Collections and Nulls • Dreams... (maybe) 7Tuesday, October 2, 12
  8. 8. Extensions • Live Demo ➡ Extension syntax ➡ How it is compiled ➡ Multiple files in a package 8Tuesday, October 2, 12
  9. 9. Bridges 9Tuesday, October 2, 12
  10. 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. 11. Kotlin Brides & Primitives Java 1 1 & Kotlin Kotlin foo(t: T) = t foo(t: Int) = t 1 1 11Tuesday, October 2, 12
  12. 12. Default Arguments 12Tuesday, October 2, 12
  13. 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. 14. Traits: Code in Interfaces class Trait$Impl { static foo()V { println("Hi") } } 14Tuesday, October 2, 12
  15. 15. Trait Hierarchy T1 foo() { println() } T2 foo() { T1$Impl.foo() } C foo() { T2$Impl.foo() } 15Tuesday, October 2, 12
  16. 16. Summary • Sometimes you need just one more method... 16Tuesday, October 2, 12
  17. 17. Collections How Data-Compatible is Your Language?Tuesday, October 2, 12
  18. 18. Collections & Variance Java: Kotlin: 18Tuesday, October 2, 12
  19. 19. Kotlins Collections 19Tuesday, October 2, 12
  20. 20. Declaration-Site Variance 20Tuesday, October 2, 12
  21. 21. Translation Ø java.util.List 21Tuesday, October 2, 12
  22. 22. Translation: Inheritance 22Tuesday, October 2, 12
  23. 23. Translation: Variance 23Tuesday, October 2, 12
  24. 24. Calling Java From Kotlin 24Tuesday, October 2, 12
  25. 25. Summary • Kotlins collections ➡ Better than Javas ➡ Still Compatible 25Tuesday, October 2, 12
  26. 26. Nullable TypesTuesday, October 2, 12
  27. 27. Demo • Kotlin is null-safe • Java code can be annotated for safe access 27Tuesday, October 2, 12
  28. 28. Talk Summary • Languages are about tradeoffs • Kotlin is cool :) 28Tuesday, October 2, 12
  29. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×