Upgrade to Pro — share decks privately, control downloads, hide ads and more …

偏見と妄想で語るスクリプト言語としての Swift / Swift as a Scripting Language

偏見と妄想で語るスクリプト言語としての Swift / Swift as a Scripting Language

Af64bc38c0ffcfcabdf430759ee491ce?s=128

Elvis Shi

May 18, 2022
Tweet

More Decks by Elvis Shi

Other Decks in Programming

Transcript

  1. ภݟͱໝ૝ͰޠΔ 
 εΫϦϓτݴޠͱͯ͠ͷ4XJGU f o r  2 J J

    U B  /J H IU
  2. ภݟͱໝ૝ͰޠΔ 
 εΫϦϓτݴޠͱͯ͠ͷ4XJGU

  3. IUUQTFOXJLJQFEJBPSHXJLJ4XJGU@ QSPHSBNNJOH@MBOHVBHF

  4. None
  5. ภݟͱໝ૝ͰޠΔ 
 εΫϦϓτݴޠͱͯ͠ͷ4XJGU 風 ˞4XJGU͸ίϯύΠϥݴޠͰ͢ɻ

  6. εΫϦϓτݴޠͱ͸ w ख࡞ۀͷ୅ΘΓʹɺಛఆͷϥϯλΠϜγεςϜ޲͚ʹ λεΫॲཧΛࣗಈԽ͢ΔͨΊͷϓϩάϥϛϯάݴޠ w ίϯύΠϧͯ͠όΠφϦʹ͢ΔΑΓ΋ɺجຊ࣮ߦ࣌ʹ ஞ࣍ղऍ͢Δ͜ͱ͕ଟ͍ IUUQTFOXJLJQFEJBPSHXJLJ4DSJQUJOH@MBOHVBHF

  7. εΫϦϓτݴޠͱ͸ w ख࡞ۀͷ୅ΘΓʹɺಛఆͷϥϯλΠϜγεςϜ޲͚ʹ λεΫॲཧΛࣗಈԽ͢ΔͨΊͷϓϩάϥϛϯάݴޠ w ίϯύΠϧͯ͠όΠφϦʹ͢ΔΑΓ΋ɺجຊ࣮ߦ࣌ʹ ஞ࣍ղऍ͢Δ͜ͱ͕ଟ͍ IUUQTFOXJLJQFEJBPSHXJLJ4DSJQUJOH@MBOHVBHF

  8. ୅දతͳεΫϦϓτݴޠͱ࢖͍ಓ w #BTI;TI'JTI w ؀ڥߏங w 3VCZ w ੩తղੳʢ%BOHFSʣ w

    σϓϩΠʢGBTUMBOFʣ w FUD
  9. CPPUTUSBQTI %BOHFS fi MF

  10. ୅දతͳεΫϦϓτݴޠͷಛ௃ w จ๏͸ൺֱతʹ୯७ w ϝϞϦ؅ཧͳͲ͠ͳ͍ w खܰʹॻ͚ͯಡΊΔ w ΤϯτϦʔϙΠϯτʢNBJOؔ਺ͳͲʣ͕ͳ͍ w

    ΍Γ͍ͨλεΫΛॱ൪ʹϦετΞοϓ͢Δ͚ͩ w จࣈ௨Γͨͩͷʮ٭ຊʯ
  11. ͋Εʁ 
 4XJGUͰ΋Ͱ͖ΔΜ͡ΌͶʁ

  12. ΤϯτϦʔϙΠϯτͳ͠ʹ 
 ͍͖ͳΓॲཧΛॻ͖࢝ΊͯΔ ϑΝΠϧΛࢦఆ͢Ε͹ 
 ͦͷ··࣮ߦ͞ΕΔ

  13. ΏΊΈͰ͸طʹ%BOHFS4XJGUʹҠߦத

  14. IUUQTRJJUBDPNMPWFFJUFNTBBBCF

  15. ͦ͏ɺͦͷؾ͕͋Ε͹ 
 طʹ4XJGUΛεΫϦϓτݴޠ 
 ͷΑ͏ʹ࢖͑Δ

  16. 4XJGUͱ֤छεΫϦϓτݴޠͷಛ௃ ˞ɿυΩϡϝϯτΛಡ·ͳͯ͘΋*%&ͷαϙʔτͰ͋Δఔ౓ॻ͚Δ #BTI;TI 3VCZ 4XJGU จ๏͕୯७ ˚ ˓ ˓ ҆શੑ͕ߴ͍

    ʷ ˚ ˕ τϥΠˍΤϥʔ 
 ͠΍͍͢˞ ʷ ʷ ˓ ࣮ߦ଎౓͕଎͍˞ ˚ ˓ ˓ γΣϧίϚϯυͷ 
 ݺͼग़͕͠؆୯ ˕ ˓ ˚ ϥΠϒϥϦʔ͕๛෋  ˓ ˚ ˞ɿεΫϦϓτϑΝΠϧͱͯ͠ͷ࣮ߦ଎౓
  17. 4XJGU͔ΒγΣϧίϚϯυΛݺͼग़͢ʹ͸ import Foundation func execute(_ command: String) -> String {

    let task = Process() let pipe = Pipe() task.standardOutput = pipe task.standardError = pipe task.arguments = ["-cl", command] task.launchPath = "/bin/zsh" task.launch() let data = pipe.fileHandleForReading.readDataToEndOfFile() let output = String(data: data, encoding: .utf8)! return output } print(execute(#"echo "Hello, World! from Swift!""#), terminator: "") // Hello, World! from Swift!
  18. 4XJGUͰͥͻ 
 γΣϧίϚϯυͷݺͼग़͠Λ 
 ָʹͯ͠΄͍͠

  19. 4XJGUͱ֤छεΫϦϓτݴޠͷಛ௃ ˞ɿυΩϡϝϯτΛಡ·ͳͯ͘΋*%&ͷαϙʔτͰ͋Δఔ౓ॻ͚Δ 
 ˞ɿεΫϦϓτϑΝΠϧͱͯ͠ͷ࣮ߦ଎౓ #BTI;TI 3VCZ 4XJGU จ๏͕୯७ ˚ ˓

    ˓ ҆શੑ͕ߴ͍ ʷ ˚ ˕ τϥΠˍΤϥʔ 
 ͠΍͍͢˞ ʷ ʷ ˓ ࣮ߦ଎౓͕଎͍˞ ˚ ˓ ˓ γΣϧίϚϯυͷ 
 ݺͼग़͕͠؆୯ ˕ ˓ ˚ ϥΠϒϥϦʔ͕๛෋  ˓ ˚ 🤔
  20. ࣮͸4XJGU͸εΫϦϓτ୯ମͷ࣮ߦ͸଎͍

  21. ໰୊͸ύοέʔδͱ࣮ͯ͠ߦ͢Δͱ஗͍ ˞ϑΝΠϧ෼ׂ͍ͨ͠ͱ͖͸ύοέʔδͱͯ͠ಈ͔͔͢͠ͳ͍

  22. ͨͩ͠Ωϟογϡ͕͋Ε͹͍ͩͿڐ༰Ͱ͖Δ ˞ϑΝΠϧ෼ׂ͍ͨ͠ͱ͖͸ύοέʔδͱͯ͠ಈ͔͔͢͠ͳ͍

  23. 4XJGUͰͥͻ 
 ύοέʔδϏϧυΛ 
 ͞Βʹߴ଎Խͯ͠΄͍͠ ˞΋͘͠͸ϑΝΠϧ୯ҐͷJNQPSUΛՄೳʹͯ͠΋͍͍

  24. ݁࿦ɿ4XJGU͸εΫϦϓτݴޠͱͯ͠΋࢖͑Δ w ྑ͔ͬͨ఺ w จ๏͸͔ͳΓ୯७ w ϑΝΠϧ୯ମͱͯ͠ͷ࣮ߦ଎౓͸ૣ͍ w ଞͷεΫϦϓτݴޠΑΓ͸Δ͔ʹߴ͍҆શੑ w

    վળ఺ w γΣϧͱͷ࿈ܞΛΑΓָʹͯ͠΄͍͠ w εΫϦϓτύοέʔδͱͯ͠ͷ࣮ߦ଎౓Λ্͛ͯ΄͍͠ w ϥΠϒϥϦʔʁͦΜͳͷԶΒϢʔβ͕ؤுΔ͍ͧ💪
  25. } var employedBy = "YUMEMI Inc." var job = "iOS

    Tech Lead" var favoriteLanguage = "Swift" var twitter = "@lovee" var qiita = "lovee" var github = "el-hoshino" var additionalInfo = """ ࣾ಺ϏσΦձٞͰ Vzoomer ૿΍͠·ͨ͠ʂ """ final class Me: Developable, Talkable {
  26. IUUQTXXXZVNFNJDPKQDBUFHPSZSFDSVJU

  27. ࢀߟ w IUUQTFOXJLJQFEJBPSHXJLJ4XJGU@ QSPHSBNNJOH@MBOHVBHF  w IUUQTFOXJLJQFEJBPSHXJLJ4DSJQUJOH@MBOHVBHF w IUUQTRJJUBDPNMPWFFJUFNTBBBCF w

    IUUQTHJUIVCDPNEBOHFSTXJGU w IUUQTHJUIVCDPN[FOXBSF'J[[#V[[CMPCNBTUFSTIFMMTI w IUUQTNFEJVNDPNTXMIIPXUPTPMWF fi [[CV[[CGCGEE w IUUQTTUBDLPWFS fl PXDPNRVFTUJPOTNFBTVSFUIF TIFMMTDSJQUFYFDVUJPOUJNFJONJMMJTFDPOETPONBDPT
  28. ༨ஊɿ4XJGU͸ຊ౰ʹεΫϦϓτϑΝΠϧͱͯ͠ ͷ࣮ߦ଎౓͕଎͍ͷ͔

  29. ༨ஊɿ4XJGU͸ຊ౰ʹεΫϦϓτϑΝΠϧͱͯ͠ ͷ࣮ߦ଎౓͕଎͍ͷ͔

  30. ༨ஊɿ4XJGU͸ຊ౰ʹεΫϦϓτϑΝΠϧͱͯ͠ ͷ࣮ߦ଎౓͕଎͍ͷ͔