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

Compile Time DIのススメ

s10myk4
April 03, 2018

Compile Time DIのススメ

s10myk4

April 03, 2018
Tweet

More Decks by s10myk4

Other Decks in Programming

Transcript

  1. $PNQJMFUJNF%*ͷεεϝ ࢢϲ୩(FFL˒/JHIU4DBMB.BUTVSJิ׬ܭը 

  2. ࣗݾ঺հ w Լଜ๎೭ 4IJNPNVSB5PNPZVLJ  w !TNZL w ηϓςʔχɾΦϦδφϧ w

    ਓࣄؔ࿈ͷϓϩδΣΫτͰ͸ɺओʹΞʔΩςΫτͱ 10Λ݉೚
  3. 1MBZͷ%FGBVMU͔ͩΒ(VJDF࢖ͬͯͨਓʹબ୒ࢶͷͭ ʹͳͬͯ΋Β͑ͨΒ͍͍ ίϯηϓτ

  4.  ংষ  3VOUJNF%*ͱ.BOVBM%*  .BD8JSFʹ͍ͭͯ  %*ͷओཁͳέʔεͰͷ.BD8JSFͰͷྫ  .BD8JSFͷσϝϦοτ

     "QQMJDBUJPO-PBEFSͱ͍͏ଘࡏ  ·ͱΊ ΞδΣϯμ
  5. ͦ΋ͦ΋ڽͬͨ%*ख๏͕ॏཁͳͷͰ͸ͳ͘ɺ
 ίϯϙʔωϯτͷґଘؔ܎ͷ੔ཧͭͭ͠ɺґଘؔ܎ͷ ߏஙΛγϯϓϧʹ࣮ݱ͍ͨ͠ Ϟνϕʔγϣϯ

  6. %*ʁ w ίϯϙʔωϯτؒͷؔ܎͸ΠϯλϑΣʔεΛ༻͍ͯ هड़͠ɺ۩ମతͳίϯϙʔωϯτΛࢦఆ͠ͳ͍ɻ
 ۩ମతʹͲͷίϯϙʔωϯτΛར༻͢Δ͔͸ผͷί ϯϙʔωϯτ΍֎෦ϑΝΠϧ౳Λར༻͢Δ͜ͱͰɺ ίϯϙʔωϯτؒͷґଘؔ܎Λബ͘͢Δ͜ͱ͕Ͱ͖ Δ
 
 8JLJࢀর

  7. 1MBZ'8ͷ%*ࣄ৘ w +43ʹج͍ͮͨ3VOUJNF%*ͱ$PNQJMFUJNF %*ͷ྆ํΛαϙʔτ w σϑΥϧτ͸(VJDF w جຊ͸DPOTUSVDUPS*OKFDUJPO

  8. %*ͷख๏ͷϝϦσϝ

  9. 3VOUJNF%*ͷར఺ (VJDF w ϝϦοτ
 ϘΠϥʔϓϨʔτίʔυΛ཈͑Δ
 w σϝϦοτ
 DPNQJMF࣌ʹґଘؔ܎ͷߏஙΛݕূͰ͖ͳ͍
 ΞϊςʔγϣϯIFMM
 طଘίʔυʹґଘ͕૿͑Δ

  10. $PNQJMF5JNF%*ͷར఺ w ϝϦοτ
 ܕ҆શ ίϯύΠϧ࣌ʹґଘؔ܎͕ຬͨ͞ΕΔ͜ͱΛݕূͰ͖Δ 
 ϓϨʔϯͳ4DBMBͱίϯετϥΫλύϥϝʔλΛ࢖͏͚ͩ
 ॊೈੑ͕ߴ͍
 SVOUJNFͰͷSFqFDUJPO͕ඞཁͳ͍ͷͰɺ͔͔ᷮ΋͠Εͳ͍͕ى ಈ͕࣌ؒ୹͘ͳΔ

    w σϝϦοτ
 ίʔυྔϘΠϥʔϓϨʔτ૿͑Δ
 ίϯύΠϧ͕࣌ؒ৳ͼΔ

  11. $PNQJMF5JNF%*ͷީิ w 5IJO$BLF1BUUFSO
 ඪ४ͷݴޠػೳ͚ͩͰ࣮ݱͰ͖Δ͕ɺϚχϡΞϧͰґ ଘؔ܎Λఆٛ͢Δͷਏ͍ɺϘΠϥʔϓϨʔτ͕૿͑Δ w 3FBEFS.POBE
 ఆٛͱ࣮ߦΛ෼཭͢Δ͜ͱͰ%*Λ࣮ݱ
 ґଘ͕ෳࡶʹͳΔͱѻ͍ʹ͍͘ w

    BVUPXJSJOHCZNBDSPT
 .BD8JSF
  12. "VUPXJSJOHʹΑΔ
 $PNQJMF5JNF%* w Լهͷ՝୊Λվળ w ϚχϡΞϧͰґଘؔ܎Λఆٛ͢Δͷਏ͍ w ϘΠϥʔϓϨʔτ͕૿͑Δ

  13. .BD8JSF

  14. ؆୯ͳྫ XJSFͯ͠Δͱ͜Ζ͕ϚΫϩͰԼهʹల։

  15. ͋Εɺɺ

  16. ίϯύΠϧ࣌ʹґଘؔ܎ͷݕ ূͰ͖ͯɺɺ

  17. ґଘؔ܎ΛϚΫϩ͕ղܾͯ͠ ͘Εͯɺɺ

  18. .BD8JSF࠷ߴʘ ?Т? ʗ
 γϯϓϧʂγϡοͱͯ͠Δʂ

  19. %*ͷओཁͳέʔεͰͷ NBDXJSFͷྫ Ұ෦(VJDFͰͷํ๏ͱൺֱ͠ͳ͕Βɺ%*Ͱͷओཁ ͳέʔεΛNBDXJSFͰͲΜͳײ͡Ͱ࣮ݱͰ͖Δ͔ ؆୯ͳྫΛڍ͛Δ

  20. MB[ZWBMͰͷએݴ WBMͰఆٛ͢ΔͱΠϯελϯε͕ॳظԽ͞ΕΔલʹ ࢀর͠Α͏ͱ͢ΔͱOVMMʹͳΔ
 
 MB[ZWBMͰఆٛ͢ΔͱΦϯσϚϯυͰద੾ͳॳظ ԽॱংΛࣗಈͰܭࢉ͞ΕΔ

  21. ͋Δܕʹରͯͭ͠ͷ࣮૷Λؔ࿈ ͚ͮΔ w (VJDF -JOLFECJOEJOH  w .BD8JSF

  22. ͋Δܕʹ۩ମతͳΠϯελϯεΛੜ੒͠ɺ όΠϯυ͢Δ w (VJDF
 *OTUBODF#JOEJOHTPS1SPWJEFT.FUIPETPS 1SPWJEFS#JOEJOHT
 
 Πϯελϯεੜ੒ͷෳࡶ౓ʹΑͬͯ࢖͍෼͚ΒΕΔ ͭͷํ๏͕ఏڙ͞Ε͍ͯΔ

  23. ͋Δܕʹ۩ମతͳΠϯελϯεΛੜ੒͠ɺ όΠϯυ͢Δ w *OTUBODF#JOEJOHT
 
 w 1SPWJEFS#JOEJOHT

  24. ͋Δܕʹ۩ମతͳΠϯελϯεΛੜ੒͠ɺ όΠϯυ͢Δ w .BD8JSF'BDUPSZ.FUIPE

  25. ܕύϥϝʔλΛ࢖ͬͨ%* w (VJDF5ZQF-JUFSBM w .BD8JSF

  26. ಉҰͷܕͰෳ਺Πϯελϯε #FSSZ!!#MVFPS5BHHFE<#FSSZ #MVF> XJSF<#FSSZ>UBHHFE8JUI<#MVF>

  27. 4DPQF w (VJDF
 σϑΥϧτͰ͸஋Λཁٻ͞ΕΔ౓ʹɺ৽͍͠Πϯελϯε࡞੒
 
 !4JOHMFUPO !4FTTJPO4DPQFE !3FRVFTU4DPQFEͳͲͰΠ ϯελϯεͷϥΠϑλΠϜΛมߋͰ͖Δ
 w

    .BD8JSF
 MB[ZWBMͰએݴγϯάϧτϯ
 EFGཁٻ͞ΕΔ౓ʹ৽͍͠ΠϯελϯεΛ࡞੒ͯ͠ฦ͢
 4DPQFUSBJUΛ࢖ͬͯSFRVFTU΍TFTTJPOͷ༷ͳಠࣗͷ TDPQFΛఆٛͰ͖Δ
  28. .PEVMFΛίϯύΫτʹอͭ

  29. 5FTUJOH جຊతʹ͸DPOTUSVDUPS*OKFDUJPOͳͷͰɺ
 ίϯϙʔωϯτͷ୯ମςετͰ͸ɺ
 ؆୯ʹNPDLΛͤ͞Δ

  30. 5FTUJOH w ςετ࣌ʹςετ༻ͷ%#ʹ੾Γସ͑ͨΓͰ͖Δ

  31. .BD8JSFͦͷଞػೳ w 6TJOHJNQMJDJUQBSBNFUFST w .VMUJ8JSJOH w "LLBJOUFHSBUJPO w FUDʜ

  32. .BD8JSFͷσϝϦοτ w ίϯύΠϧ͕࣌ؒ৳ͼΔ w FYQFSJNFOUBMͳػೳ NBDSPT ʹґଘͯ͠ ͍Δ

  33. "QQMJDBUJPO-PBEFSͱ͍͏ଘࡏ

  34. "QQMJDBUJPO-PBEFSͱ͸ (VJDFͷ৔߹͸ɺ(VJDF"QQMJDBUJPO#VJMEFS͍ͬͯ͏ϔϧύʔ͕ ఏڙ͞Ε͍ͯͯSFGFSFODFDPOGʹඪ४Ͱઃఆ͞ΕͯͨͷͰ ಛ ʹҙࣝ͠ͳͯ͘ࡁΜͩ 
 ΞϓϦέʔγϣϯࣗମͰߏஙͰ͖ͳ͍Α͏ͳίϯςΩετΛ༩ ͑ΒΕͯ 
 ΞϓϦέʔγϣϯΛΠϯελϯεԽ͢Δ໾ׂ

    "QQMJDBUJPO-PBEFS಺Ͱίϯϙʔωϯτͷґଘؔ܎ΛղܾͰ͖ ΔΑ͏ʹͯ͋͛͠Δඞཁ͕͋Δ
  35. None
  36. ·ͱΊ .BD8JSFͰͷDPNQJMFUJNF%*΋ݒ೦఺͸͋Δ΋ͷͷɺ 5IJODBLFQBUUFSOͷσϝϦοτͰ͋ͬͨίʔυྔ΍Ϙ ΠϥʔϓϨʔτ͕ۃྗগͳ͘ɺ$PNQJMFUJNF%*Λ࣮ ݱͰ͖Δͷ͸ͱͯ΋ྑ͍
 ػೳ΋ॆ࣮͓ͯ͠Γɺ࢖͍ํ΋γϯϓϧͰ͋Δ

  37. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠