SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Shoulders of Giants
Andrey Breslav
Sir Isaac Newton
If I have seen further it is
by standing on the
shoulders of Giants
Letter to Robert Hooke, 1675
Bernard of Charters
[Dicebat Bernardus Carnotensis nos esse quasi]
nanos gigantium
humeris incidentes.
XII c.
Why I’m giving this talk
The right question
Why don’t all language designers give such talks?
Every language has learned from others
Is it morally wrong? Or maybe even illegal?
“In science and in art, there are, and can be, few, if any things, which in
an abstract sense are strictly new and original throughout. Every book
in literature, science, and art borrows, and must necessarily borrow,
and use much which was well known and used before.”
Supreme Court Justice David Souter
Campbell v. Acuff-Rose Music, Inc., 510 U.S. 569 (1994)
Does it make them worse?
• Is originality what really matters to you as a developer?
• Put in on the scale with productivity and maintainability 
• But I want to
• … stand out
• … be proud of my language (and its authors)
• ... win arguments with fans of other languages
• … write awesome software, maybe? 
What do language designers think?
• The Kotlin team had productive discussions with
• Brian Goetz
• Martin Odersky
• Erik Meijer
• Chris Lattner
• … looking forward to having more!
My ideal world
• Everyone builds on top of others’ ideas
• Everyone openly admits it and says thank you
• Difference from academia: it’s OK to not look at some prior work 
So, what languages has Kotlin
learned from?
From Java: classes!
• One superclass
• Multiple superinterfaces
• No state in interfaces
• Constructors (no destructors)
• Nested/inner classes
• Annotations
• Method overloading
• One root class
• toString/equals/hashCode
• Autoboxing
• Erased generics
• Runtime safety guarantees
Leaving things out: Java
• Monitor in every object
• finalize()
• Covariant arrays
• Everything implicitly nullable
• Primitive types are not classes
• Mutable collection interfaces
• Static vs instance methods
• Raw types
• …
From Java…
class C : BaseClass, I1, I2 {
class Nested { ... }
inner class Inner { ... }
}
From Scala, C#...
class C(p: Int, val pp: I1) : B(p, pp) {
internal var foo: Int
set(v) { field = check(v) }
override fun toString() = "..."
}
Not Kotlin
class Person {
private var _name: String
def name = _name
def name_=(aName: String) { _name = aName }
}
Not Kotlin
class Person {
private string _Name;
public string Name {
get { return _Name; }
set { _Name = value }
}
}
Kotlin
class Person {
private var _name = "..."
var name: String
get() = _name
set(v) { _name = v }
}
Leaving things out: Interfaces vs Scala Traits
• No state allowed
• no fields
• no constructors
• Order doesn’t matter
• no linearization rules
• Delegation through by
Some (more) differences…
class C(d: Intf) : Intf by d {
init { println(d) }
fun def(x: Int = 1) { ... }
fun test() {
def(x = 2)
}
}
And a bit more…
val person = Person("Jane", "Doe")
val anonymous = object : Base() {
override fun foo() { ... }
}
From Scala…
object Singleton : Base(foo) {
val bar = ...
fun baz(): String { ... }
}
Singleton.baz()
Companion objects
class Data private (val x: Int) {
companion object {
fun create(x) = Data(x)
}
}
val data = Data.create(10)
Companion objects
class Data private (val x: Int) {
companion object {
@JvmStatic
fun create(x) = Data(x)
}
}
val data = Data.create(10)
BTW: Not so great ideas
• Companion objects 
• Inheritance by delegation 
From C#...
class Person(
val firstName: String,
val lastName: String
)
fun Person.fullName() {
return "$firstName $lastName"
}
Not Kotlin
implicit class RichPerson(p: Person) {
def fullName = s"${p.firstName} ${p.lastName}"
}
class PersonUtil {
public static string FullName(this Person p) {
return $"{p.firstName} {p.lastName}"
}
}
It’s Groovy time!
mylist
.filter { it.foo }
.map { it.bar }
Not Kotlin
mylist.filter(_.foo).map(_.bar)
mylist.stream()
.filter((it) -> it.getFoo())
.map((it) -> it.getBar())
.collect(Collectors.toList())
mylist.Where(it => it.foo).Select(it => it.bar)
Not Kotlin (yet…)
for (it <- mylist if it.foo)
yield it.bar
from it in mylist where it.foo select it.bar
[it.bar for it in mylist if it.foo]
It’s Groovy time!
val foo = new Foo()
foo.bar()
foo.baz()
foo.qux() with(foo) {
bar()
baz()
qux()
}
DSLs: Type-Safe Builders
a(href = "http://my.com") {
img(src = "http://my.com/icon.png")
}
Not Kotlin 
10 PRINT "Welcome to Baysick Lunar Lander v0.9"
20 LET ('dist := 100)
30 LET ('v := 1)
40 LET ('fuel := 1000)
50 LET ('mass := 1000)
60 PRINT "You are drifting towards the moon."
Not Kotlin 
object Lunar extends Baysick {
def main(args:Array[String]) = {
10 PRINT "Welcome to Baysick Lunar Lander v0.9"
20 LET ('dist := 100)
30 LET ('v := 1)
40 LET ('fuel := 1000)
50 LET ('mass := 1000)
60 PRINT "You are drifting towards the moon."
}
}
From Scala: Data Classes
data class Person(
val first: String,
val last: String
) {
override fun equals(other: Any?): Boolean
override fun hashCode(): Int
override fun toString(): String
fun component1() = first
fun component2() = last
fun copy(first: String = this.first, last: String = this.last)
}
val (first, last) = myPerson
Not Kotlin
val greeting = x match {
case Person(f, l) => s"Hi, $f $l!"
case Pet(n) => s"Hi, $n!"
_ => "Not so greetable O_o"
}
From Gosu: Smart casts
val greeting = when (x) {
is Person -> "Hi, ${x.first} ${x.last}!"
is Pet -> "Hi, ${x.name}!"
else -> "Not so greetable o_O"
}
From Groovy, C#: Elvis and friends
val middle = p.middleName ?: "N/A"
persons.firstOrNull()?.firstName ?: "N/A"
nullable!!.foo
(foo as Person).bar
(foo as? Person)?.bar
Java/Scala/C#: Generics
abstract class Read<out T> {
abstract fun read(): T
}
interface Write<in T> {
fun write(t: T)
}
Java/Scala/C#: Generics
class RW<T>(var t: T): Read<T>, Write<T> {
override fun read(): T = t
override fun write(t: T) {
this.t = t
}
}
fun foo(from: RW<out T>, to: RW<in T>) {
to.write(from.read())
}
Do other languages learn from Kotlin?
• I can't be 100% sure, but looks like they do
• xTend
• Hack
• Swift
• Java?
• C#?
• But let them speak for themselves!
My ideal world
• Everyone builds on top of others’ ideas
• Everyone openly admits it and says thank you
• Difference from academia: it’s OK to not look at some prior work 
P.S. My Personal Workaround
In practice, languages are often
selected by passion, not reason.
Much as I’d like it to be the other way around,
I see no way of changing that.
So, I’m trying to make Kotlin a
language that is loved for a reason 

Weitere ähnliche Inhalte

Ähnlich wie Shoulders of giants: Languages Kotlin learned from

Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Andrey Breslav
 
Crystal presentation in NY
Crystal presentation in NYCrystal presentation in NY
Crystal presentation in NYCrystal Language
 
Let's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to KotlinLet's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to KotlinAliaksei Zhynhiarouski
 
Kotlin 101 for Java Developers
Kotlin 101 for Java DevelopersKotlin 101 for Java Developers
Kotlin 101 for Java DevelopersChristoph Pickl
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsJigar Gosar
 
Intro to Kotlin
Intro to KotlinIntro to Kotlin
Intro to KotlinMagda Miu
 
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018 Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018 Codemotion
 
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Andrés Viedma Peláez
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Mohamed Nabil, MSc.
 
Kotlin coroutines and spring framework
Kotlin coroutines and spring frameworkKotlin coroutines and spring framework
Kotlin coroutines and spring frameworkSunghyouk Bae
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxIan Robertson
 
Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.James Curran
 
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsTMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsIosif Itkin
 
Kotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in KotlinKotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in KotlinJetBrains Russia
 
Threequals - Case Equality in Ruby
Threequals - Case Equality in RubyThreequals - Case Equality in Ruby
Threequals - Case Equality in RubyLouis Scoras
 

Ähnlich wie Shoulders of giants: Languages Kotlin learned from (20)

Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011
 
Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011
 
Crystal presentation in NY
Crystal presentation in NYCrystal presentation in NY
Crystal presentation in NY
 
Let's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to KotlinLet's fly to the Kotlin Island. Just an introduction to Kotlin
Let's fly to the Kotlin Island. Just an introduction to Kotlin
 
Kotlin 101 for Java Developers
Kotlin 101 for Java DevelopersKotlin 101 for Java Developers
Kotlin 101 for Java Developers
 
Kotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrainsKotlin: A pragmatic language by JetBrains
Kotlin: A pragmatic language by JetBrains
 
Intro to Kotlin
Intro to KotlinIntro to Kotlin
Intro to Kotlin
 
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018 Meetup di GDG Italia - Leonardo Pirro -  Codemotion Rome 2018
Meetup di GDG Italia - Leonardo Pirro - Codemotion Rome 2018
 
Scala fundamentals
Scala fundamentalsScala fundamentals
Scala fundamentals
 
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3
 
Crystal Rocks
Crystal RocksCrystal Rocks
Crystal Rocks
 
Why Kotlin is your next language?
Why Kotlin is your next language? Why Kotlin is your next language?
Why Kotlin is your next language?
 
Kotlin coroutines and spring framework
Kotlin coroutines and spring frameworkKotlin coroutines and spring framework
Kotlin coroutines and spring framework
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptx
 
Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.
 
Kotlin intro
Kotlin introKotlin intro
Kotlin intro
 
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart CastsTMPA-2015: Kotlin: From Null Dereference to Smart Casts
TMPA-2015: Kotlin: From Null Dereference to Smart Casts
 
Kotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in KotlinKotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
 
Threequals - Case Equality in Ruby
Threequals - Case Equality in RubyThreequals - Case Equality in Ruby
Threequals - Case Equality in Ruby
 

Mehr von Andrey Breslav

Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Andrey Breslav
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinAndrey Breslav
 
Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015Andrey Breslav
 
Introduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clearIntroduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clearAndrey Breslav
 
Kotlin for Android: Brief and Clear
Kotlin for Android: Brief and ClearKotlin for Android: Brief and Clear
Kotlin for Android: Brief and ClearAndrey Breslav
 
Kotlin (Introduction for students)
Kotlin (Introduction for students)Kotlin (Introduction for students)
Kotlin (Introduction for students)Andrey Breslav
 
Kotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language designKotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language designAndrey Breslav
 
Kotlin gets Reflection
Kotlin gets ReflectionKotlin gets Reflection
Kotlin gets ReflectionAndrey Breslav
 
Language Design Trade-offs
Language Design Trade-offsLanguage Design Trade-offs
Language Design Trade-offsAndrey Breslav
 
Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?Andrey Breslav
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Andrey Breslav
 
JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language ImplementationJavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language ImplementationAndrey Breslav
 
[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java Interop[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java InteropAndrey Breslav
 
Kotlin @ CSClub & Yandex
Kotlin @ CSClub & YandexKotlin @ CSClub & Yandex
Kotlin @ CSClub & YandexAndrey Breslav
 
Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011Andrey Breslav
 

Mehr von Andrey Breslav (17)

Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?Future of Kotlin - How agile can language development be?
Future of Kotlin - How agile can language development be?
 
JVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in KotlinJVMLS 2016. Coroutines in Kotlin
JVMLS 2016. Coroutines in Kotlin
 
Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015Flexible Types in Kotlin - JVMLS 2015
Flexible Types in Kotlin - JVMLS 2015
 
Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014
 
Introduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clearIntroduction to Kotlin: Brief and clear
Introduction to Kotlin: Brief and clear
 
Kotlin for Android: Brief and Clear
Kotlin for Android: Brief and ClearKotlin for Android: Brief and Clear
Kotlin for Android: Brief and Clear
 
Kotlin (Introduction for students)
Kotlin (Introduction for students)Kotlin (Introduction for students)
Kotlin (Introduction for students)
 
Kotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language designKotlin: Challenges in JVM language design
Kotlin: Challenges in JVM language design
 
Kotlin gets Reflection
Kotlin gets ReflectionKotlin gets Reflection
Kotlin gets Reflection
 
Language Design Trade-offs
Language Design Trade-offsLanguage Design Trade-offs
Language Design Trade-offs
 
Functions and data
Functions and dataFunctions and data
Functions and data
 
Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?Kotlin: Incompetence * Motivation = Innovation?
Kotlin: Incompetence * Motivation = Innovation?
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
 
JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language ImplementationJavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
JavaOne2012: Kotlin: Practical Aspects of JVM Language Implementation
 
[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java Interop[JVMLS 12] Kotlin / Java Interop
[JVMLS 12] Kotlin / Java Interop
 
Kotlin @ CSClub & Yandex
Kotlin @ CSClub & YandexKotlin @ CSClub & Yandex
Kotlin @ CSClub & Yandex
 
Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011Kotlin @ StrangeLoop 2011
Kotlin @ StrangeLoop 2011
 

Kürzlich hochgeladen

OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 

Kürzlich hochgeladen (20)

OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 

Shoulders of giants: Languages Kotlin learned from

  • 2. Sir Isaac Newton If I have seen further it is by standing on the shoulders of Giants Letter to Robert Hooke, 1675
  • 3. Bernard of Charters [Dicebat Bernardus Carnotensis nos esse quasi] nanos gigantium humeris incidentes. XII c.
  • 4.
  • 5. Why I’m giving this talk
  • 6.
  • 7. The right question Why don’t all language designers give such talks? Every language has learned from others
  • 8. Is it morally wrong? Or maybe even illegal? “In science and in art, there are, and can be, few, if any things, which in an abstract sense are strictly new and original throughout. Every book in literature, science, and art borrows, and must necessarily borrow, and use much which was well known and used before.” Supreme Court Justice David Souter Campbell v. Acuff-Rose Music, Inc., 510 U.S. 569 (1994)
  • 9. Does it make them worse? • Is originality what really matters to you as a developer? • Put in on the scale with productivity and maintainability  • But I want to • … stand out • … be proud of my language (and its authors) • ... win arguments with fans of other languages • … write awesome software, maybe? 
  • 10. What do language designers think? • The Kotlin team had productive discussions with • Brian Goetz • Martin Odersky • Erik Meijer • Chris Lattner • … looking forward to having more!
  • 11. My ideal world • Everyone builds on top of others’ ideas • Everyone openly admits it and says thank you • Difference from academia: it’s OK to not look at some prior work 
  • 12. So, what languages has Kotlin learned from?
  • 13. From Java: classes! • One superclass • Multiple superinterfaces • No state in interfaces • Constructors (no destructors) • Nested/inner classes • Annotations • Method overloading • One root class • toString/equals/hashCode • Autoboxing • Erased generics • Runtime safety guarantees
  • 14. Leaving things out: Java • Monitor in every object • finalize() • Covariant arrays • Everything implicitly nullable • Primitive types are not classes • Mutable collection interfaces • Static vs instance methods • Raw types • …
  • 15. From Java… class C : BaseClass, I1, I2 { class Nested { ... } inner class Inner { ... } }
  • 16. From Scala, C#... class C(p: Int, val pp: I1) : B(p, pp) { internal var foo: Int set(v) { field = check(v) } override fun toString() = "..." }
  • 17. Not Kotlin class Person { private var _name: String def name = _name def name_=(aName: String) { _name = aName } }
  • 18. Not Kotlin class Person { private string _Name; public string Name { get { return _Name; } set { _Name = value } } }
  • 19. Kotlin class Person { private var _name = "..." var name: String get() = _name set(v) { _name = v } }
  • 20. Leaving things out: Interfaces vs Scala Traits • No state allowed • no fields • no constructors • Order doesn’t matter • no linearization rules • Delegation through by
  • 21. Some (more) differences… class C(d: Intf) : Intf by d { init { println(d) } fun def(x: Int = 1) { ... } fun test() { def(x = 2) } }
  • 22. And a bit more… val person = Person("Jane", "Doe") val anonymous = object : Base() { override fun foo() { ... } }
  • 23. From Scala… object Singleton : Base(foo) { val bar = ... fun baz(): String { ... } } Singleton.baz()
  • 24. Companion objects class Data private (val x: Int) { companion object { fun create(x) = Data(x) } } val data = Data.create(10)
  • 25. Companion objects class Data private (val x: Int) { companion object { @JvmStatic fun create(x) = Data(x) } } val data = Data.create(10)
  • 26. BTW: Not so great ideas • Companion objects  • Inheritance by delegation 
  • 27. From C#... class Person( val firstName: String, val lastName: String ) fun Person.fullName() { return "$firstName $lastName" }
  • 28. Not Kotlin implicit class RichPerson(p: Person) { def fullName = s"${p.firstName} ${p.lastName}" } class PersonUtil { public static string FullName(this Person p) { return $"{p.firstName} {p.lastName}" } }
  • 29. It’s Groovy time! mylist .filter { it.foo } .map { it.bar }
  • 30. Not Kotlin mylist.filter(_.foo).map(_.bar) mylist.stream() .filter((it) -> it.getFoo()) .map((it) -> it.getBar()) .collect(Collectors.toList()) mylist.Where(it => it.foo).Select(it => it.bar)
  • 31. Not Kotlin (yet…) for (it <- mylist if it.foo) yield it.bar from it in mylist where it.foo select it.bar [it.bar for it in mylist if it.foo]
  • 32. It’s Groovy time! val foo = new Foo() foo.bar() foo.baz() foo.qux() with(foo) { bar() baz() qux() }
  • 33. DSLs: Type-Safe Builders a(href = "http://my.com") { img(src = "http://my.com/icon.png") }
  • 34. Not Kotlin  10 PRINT "Welcome to Baysick Lunar Lander v0.9" 20 LET ('dist := 100) 30 LET ('v := 1) 40 LET ('fuel := 1000) 50 LET ('mass := 1000) 60 PRINT "You are drifting towards the moon."
  • 35. Not Kotlin  object Lunar extends Baysick { def main(args:Array[String]) = { 10 PRINT "Welcome to Baysick Lunar Lander v0.9" 20 LET ('dist := 100) 30 LET ('v := 1) 40 LET ('fuel := 1000) 50 LET ('mass := 1000) 60 PRINT "You are drifting towards the moon." } }
  • 36. From Scala: Data Classes data class Person( val first: String, val last: String ) { override fun equals(other: Any?): Boolean override fun hashCode(): Int override fun toString(): String fun component1() = first fun component2() = last fun copy(first: String = this.first, last: String = this.last) } val (first, last) = myPerson
  • 37. Not Kotlin val greeting = x match { case Person(f, l) => s"Hi, $f $l!" case Pet(n) => s"Hi, $n!" _ => "Not so greetable O_o" }
  • 38. From Gosu: Smart casts val greeting = when (x) { is Person -> "Hi, ${x.first} ${x.last}!" is Pet -> "Hi, ${x.name}!" else -> "Not so greetable o_O" }
  • 39. From Groovy, C#: Elvis and friends val middle = p.middleName ?: "N/A" persons.firstOrNull()?.firstName ?: "N/A" nullable!!.foo (foo as Person).bar (foo as? Person)?.bar
  • 40. Java/Scala/C#: Generics abstract class Read<out T> { abstract fun read(): T } interface Write<in T> { fun write(t: T) }
  • 41. Java/Scala/C#: Generics class RW<T>(var t: T): Read<T>, Write<T> { override fun read(): T = t override fun write(t: T) { this.t = t } } fun foo(from: RW<out T>, to: RW<in T>) { to.write(from.read()) }
  • 42. Do other languages learn from Kotlin? • I can't be 100% sure, but looks like they do • xTend • Hack • Swift • Java? • C#? • But let them speak for themselves!
  • 43. My ideal world • Everyone builds on top of others’ ideas • Everyone openly admits it and says thank you • Difference from academia: it’s OK to not look at some prior work 
  • 44. P.S. My Personal Workaround In practice, languages are often selected by passion, not reason. Much as I’d like it to be the other way around, I see no way of changing that. So, I’m trying to make Kotlin a language that is loved for a reason 

Hinweis der Redaktion

  1. https://upload.wikimedia.org/wikipedia/commons/4/4a/Library_of_Congress%2C_Rosenwald_4%2C_Bl._5r.jpg
  2. https://upload.wikimedia.org/wikipedia/commons/3/39/GodfreyKneller-IsaacNewton-1689.jpg
  3. https://upload.wikimedia.org/wikipedia/commons/3/39/GodfreyKneller-IsaacNewton-1689.jpg
  4. https://upload.wikimedia.org/wikipedia/commons/4/4a/Library_of_Congress%2C_Rosenwald_4%2C_Bl._5r.jpg
  5. https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Warsaw_Pillow_Fight_2010_%284488607206%29.jpg/1280px-Warsaw_Pillow_Fight_2010_%284488607206%29.jpg
  6. https://en.wikipedia.org/wiki/David_Souter#/media/File:DavidSouter.jpg