Multiplatform Projectsの向かう先 #m3kt

Multiplatform Projectsの向かう先 #m3kt

A87027204ff57be1dadbf36a78a73c1b?s=128

Takaki Hoshikawa

January 18, 2018
Tweet

Transcript

  1. 5 / 8 # 2013

  2.  • i e • d # k • 7

    A N T S • 1@7 5 KC 3 5 78 7 • laD • • 7 27 7 # nm N • 0 / # bo g DN # KE O 7 8 #
  3.  # 1/02

  4.        # 2013 /

    /
  5. ! # 1/02 fun main(args: Array<String>) { println("Hello world!") }

  6.   kotlin.io.readLine000 JVM 58 # 3126 / / fun

    main(args: Array<String>) { val name = readLine() println("Hello $name!") }
  7. # 2013 / / import java.io.BufferedReader import java.io.File fun main(args:

    Array<String>) { val name = File("name.txt") .bufferedReader() .use { it.readLine() } println("Hello $name!") }
  8.        # 1/02

  9. # 2013 / /

  10.  • 2 /-1 3 /- 20021 C 8 #

    # # 2 /-1 0 # fun main(args: Array<String>) { println("Hello world!") } 20021 2 /-1 5
  11.  • 15 2/ 2/- 0 1 # *5 2/

    3 1 fun main(args: Array<String>) { val name = readLine() println("Hello $name!") } *5 2/ 8
  12.  # 53 01 / 1 # import java.io.BufferedReader import

    java.io.File fun main(args: Array<String>) { val name = File("name.txt") .bufferedReader() .use { it.readLine() } println("Hello $name!") } 01 / 28
  13.  • /350-2 5 0- # # # 8 350-2

    1 /5 # fun main(args: Array<String>) { window.alert("Hello World!") } 350-2
  14.      # 2013 / /

  15.    # 1/02 expect object Hello { fun

    say() }
  16.   # 2013 / / actual object Hello {

    actual fun say() = showDialog("Hello!") } actual object Hello { actual fun say() = window.alert("Hello!") }
  17. • 72 3 8 • 2 5 # 1 0

    / expect open class BigInteger(`val`: String) { open fun add(`val`: BigInteger): BigInteger } actual typealias BigInteger = java.math.BigInteger  
  18. • ,8 , 31132 13 0, 0 351 13 0,

    # # # 3 0 2 1 / # fun main(args: Array<String>) { val bi = BigInteger(”10”) val sum = bi.add(BigInteger(”20”)) ... } 
  19. • 8 9 0 0 351 13 0 # 3

    0 2 1 / fun main(args: Array<String>) { val bi = BigInteger(”10”) val div = bi.divide(BigInteger(”5”)) ... } 
  20. # 1/02 #

  21.     # 1/02 #

  22. # 1/02 ##

  23.     # 1/02 #

  24.  $  #!  "   # 2013

    / / #
  25.  # 1/02 #

  26. # D C 8 # 5 5 K K 163

    K MO A 56 0 6 6 2 2 2 D 56 0 6 6 56 0 6 6 /6 /6 /6 /6   C
  27. # ) ) LJK D D ( 12 5 7

    D D D 3 CD 3 CD 3 CD 0 3 CD VSW 0VSW b T 0 8D // 0VSW 0 8D 2VSW 0 8D D 8 CCML 0 a A 8D  J O dc
  28. # ( ( SN A ( ) CA b 12

    b 5 b A CA C A CA C A CA C 3 D 3 D 3 D /A 3 D fl aJc / aJc fn J /A 8 / aJc /A 8 2 aJc /A 8 8 DDTS  N M i /A me 8 po K A 0 VW / AC kd O LTL
  29. # ( ( D 8 9 ) 58 V M

    T 1 M T V L 58 23 28 1 M T 58 23 28 / M T 58 23 28 2 2 382 K S 1 M T K S 1 M T K S / M T K S V M T 05 K SJ V L 58 5 53
  30.   • U X K in RK el m

    -3- 0 K • - 15K ck /- R15 20 /- K U 8 U oa R U I R # # # 5 20 3 1
  31.   • 5820 aK D D • K0 8

    / 8fJ J • e JI 8 • S c 5820 D k i # I 5820 3 18
  32.  # 8 53 /- 2 13 2 - .8

    8-8/ 3 3 8 53 5 3 5 08: 5/
  33.  # 1/02

  34.      • 4 30 / 0

    8 4 K • 53354 58204 C TS K # 58204 3 18 val hoge: dynamic = object {} hoge.fuga = {} // OK hoge.piyo().xxx.yyy() // OK
  35.         • 351

    2 3 23 3 8 K # 8 03 / 3 expect class System { companion object { fun currentTimeMillis(): Long } } // NG actual typealias System = java.lang.System
  36.         • 6

    0 5 8 K 8 31 2 32 3 6 K # 360 2 1 /6 // OK actual class System { actual companion object { actual fun currentTimeMillis() = java.lang.System.currentTimeMillis() } }
  37.         • 7

    0 5 8 K 8 31 2 32 3 K # 3 0 2 1 / // OK actual fun System.Companion.currentTimeMillis() = java.lang.System.currentTimeMillis() class System { companion object } expect fun System.Companion.currentTimeMillis(): Long
  38.     • - C5 # A A

    5BB • .A ,A Wkp df • 8CA 8 03 3 C C .A RrM J • 03W sWtOWv 0 ,RrM J • .A # A ACA • a b e cef • / B 5 AC uio • 2 -5 5 -3W1CA SWj nJ mK / B 5 AC lJ J # # PR .A
  39.  • 0 3 8 521 M 9 iK 9

    9 ,0 2 l akJk • 0 3 8f X X e N /080 9 f jKJ S • cK # # # P 9 8