Slide 1

Slide 1 text

੩తܕ෇͚ϓϩάϥϛ ϯάݴޠShiika 2020-10-09 ࣗ࡞ϓϩάϥϛϯάݴޠͷू͍ @yhara (Yutaka HARA)

Slide 2

Slide 2 text

@yhara • ౡࠜݝࡏॅ • ωοτϫʔΫԠ༻௨৴ݚڀॴ • झຯɿݴޠॲཧܥͷ։ൃ • BiwaScheme (R7RS Scheme in JS) • ॻ੶ʰRubyͰͭ͘Δحົͳϓϩάϥϛϯάݴޠʱ ࠷ۙͷڵຯɿΫϥϑτ Ϗʔϧࣗ࡞ΩʔϘʔ υ0DVMVT2VFTU $MBTI3PZBMF4PVM PG&EFO$PPLJF $MJDLFS

Slide 3

Slide 3 text

• Brainf*ckͳͲͷ͍ΘΏΔesolangΛͭ͘Δຊ • খ͞ͳϓϩάϥϛϯάݴޠͰॲཧܥ࣮૷Λֶ Ϳ • Ruby஌Βͳͯ͘΋OK

Slide 4

Slide 4 text

Shiika • github: yhara/shiika • Ruby෩ͷจ๏ʴ੩తܕ෇͚ݴޠ • 2017ʙ • ࣮૷ɿRust + LLVM

Slide 5

Slide 5 text

໨ඪ • ࣮༻ݴޠΛ໨ࢦ͢ • Χόʔൣғ͸Rubyͱ͍͍ͩͨಉ͡ 4IJJLB 3VCZ 8FCΞϓϦ ˕ ˕ εΫϦϓςΟϯά ˓ ˕ ήʔϜ ˕ ˓ ਺஋ܭࢉ ˓ ˚ ϫϯϥΠφɺίʔυΰϧϑ ˓

Slide 6

Slide 6 text

σϞ • examples/ray.sk

Slide 7

Slide 7 text

ಈػ • Ruby͕޷͖͚ͩͲ੩తܕ΋ཉ͍͠ • έΞϨεϛεΛ࣮ߦલʹڭ͑ͯ΄͍͠ • ܕ͕ॻ͍ͯ͋Δͱಡղʹ໾ཱͭ • ܕ͔Βઃܭ͢Δָ͠Έ • Rubyͷʮॻ͖ຯʯΛ࣋ͬͨ੩తܕݴޠΛ࡞Εͳ͍͔

Slide 8

Slide 8 text

ʮॻ͖ຯʯͱ͸ʁʁ • ࢖͍ͪ͜͝ • ;Θͬͱ͍ͯ͠Δ…

Slide 9

Slide 9 text

Rubyͷॻ͖ຯΛߏ੒͢Δ΋ͷ • ʮεΫϦϓτݴޠʯͰ͋Δ͜ͱ • ୹͘ॻ͚Δ • ֤छsyntax sugarɾ๛෋ͳ૊ΈࠐΈϝιου • ָ͞ʼੑೳ • Fixnum͔ΒBignum΁ͷࣗಈঢ֨ • େΫϥεओٛ(Hashͷॱং͕อ࣋͞ΕΔ౳)

Slide 10

Slide 10 text

Rubyͷॻ͖ຯΛߏ੒͢Δ΋ͷ • ౷Ұײ • શ͕ͯΦϒδΣΫτͰ͋Δ (1.timesͱ͔) • if΍case-when΋஋Λ΋ͭ

Slide 11

Slide 11 text

ݴޠઃܭͷτϨʔυΦϑ • ੑೳ vs ָ͞ • eg. Bignum • ಡΈ΍͢͞ vs ॻ͖΍͢͞ • eg. syntax sugar

Slide 12

Slide 12 text

ݴޠઃܭ

Slide 13

Slide 13 text

จ๏ • جຊRubyͱಉ͡ • ྫɿϝιουݺͼग़͠ͷׅހ͸লུՄ • EnumͳͲɺRubyʹͳ͍΋ͷ͸࢓༷Λݕ౼

Slide 14

Slide 14 text

ܕγεςϜ • ͋·Γ೉͍͠΋ͷ͸ೖΕͨ͘ͳ͍(๻͕ಡΊͳ ͘ͳΔͷͰ) • ͱ͸͍͑δΣωϦΫε(parametricଟ૬)͘Β͍ ͸ཁΔ • ͳ͍ͱArray΋Hash΋࡞Εͳ͍…

Slide 15

Slide 15 text

ΫϥεͱϝλΫϥε "abc" "abc".class #=> String String #=> String String.name #=> "String" String.class #=> Meta:String Array #=> Array Array.name #=> "Array" Array.new #=> [] Array.class #=> Meta:Array

Slide 16

Slide 16 text

ͳͥClassͰ͸ͳ͍ͷ͔ • Rubyͩͱ String΋Array΋਌͸ClassΫϥε • ͔͠͠String.newͱArray.new͸(౰વͳ͕Β)γ άωνϟ͕ҧ͏ • => Class.newͷγάωνϟ͕ҰҙͰͳ͍ • => ͦΕͧΕҧ͏਌Λ΋ͭ͜ͱʹͨ͠

Slide 17

Slide 17 text

༨ஊɿΫϥεͱܕͷؔ܎ • Ϋϥε != ܕ • ྫɿfoo(x: Float) • x͸FloatͷଞʹIntͰ΋Α͍ • ܕʹ஋ͷू߹(ͲͷΑ͏ͳΫϥεͷΠϯελϯ εΛڐ͔͢) ͜͜͸ΫϥεͰ͸ͳ͘ɺ ܕΛॻ͘ཝ

Slide 18

Slide 18 text

ޓ׵ੑʹ͍ͭͯ • Rubyͱͷޓ׵ੑ͸ॏࢹ͠ͳ͍ɻྫɿ • Ruby: "foo".start_with?("f") • Rust: "foo".starts_with("f") • startsʹ߹Θ͍ͤͨ

Slide 19

Slide 19 text

ࠓޙͷల๬

Slide 20

Slide 20 text

ೖΕ͍ͨ΋ͷ • Enum (Option͕΄͍͠) • ύλʔϯϚον

Slide 21

Slide 21 text

ݕ౼தͷ΋ͷ • RubyͷModuleతͳ΋ͷ • ྫ֎ʁ • async/await

Slide 22

Slide 22 text

ೖΕͳ͍΋ͷ • Ϣʔβఆٛԋࢉࢠ • ߏจ໦ϚΫϩ • ಡղ͕େมͳͷͰ • Rubyͷdefine_methodͷΑ͏ʹɺओͳ༻్ΛΧόʔ͢Δ΋ͷ(Ṗ)Λ୅Θ ΓʹೖΕ͍ͨ • ηϧϑϗετ͸͠ͳ͍ • σόοά͕େม • ௒௕ظతʹ͸ੑೳ͕ॏཁʹͳΔ

Slide 23

Slide 23 text

΍Δ͜ͱ͸ແݶʹ͋Δ • ... • ෼ׂίϯύΠϧ • ඪ४ϥΠϒϥϦ • ύοέʔδγεςϜ • ...

Slide 24

Slide 24 text

Ұॹʹ΍Γ·͠ΐ͏ʂʂ • ݴޠॲཧܥSlack • https://prog-lang-sys-ja-slack.github.io/ wiki/ • νϟϯωϧ #shiika • https://github.com/yhara/shiika