Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
“kenkenize”で触れるRubyの中身 / Kenkenization and the ...
Search
Kentaro Kuribayashi
October 31, 2019
1
430
“kenkenize”で触れるRubyの中身 / Kenkenization and the Ruby Internal
K-Ruby #24
https://k-ruby.connpass.com/event/151523/
Kentaro Kuribayashi
October 31, 2019
Tweet
Share
More Decks by Kentaro Kuribayashi
See All by Kentaro Kuribayashi
Bidirectional Quadratic Voting Leveraging Issue-Based Matching
kentaro
2
320
大高生へのメッセージ(令和6年度「大高未来塾」) / Messages to Current Students
kentaro
0
230
「始め方」の始め方 / How to Start Starting Things
kentaro
5
840
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
1.2k
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
480
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
5.1k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
41
22k
キャリアを時間・空間軸で考える / Thinking about your career from both time and space viewpoints
kentaro
15
16k
WEB+DB PRESSで特集記事を書く方法 / How to Become an Author of WEB+DB PRESS
kentaro
7
1.5k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Navigating Team Friction
lara
183
15k
Done Done
chrislema
181
16k
Building Adaptive Systems
keathley
38
2.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
How STYLIGHT went responsive
nonsquared
95
5.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
Code Review Best Practice
trishagee
65
17k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
How GitHub (no longer) Works
holman
311
140k
Transcript
ʙϝλϓϩάϥϛϯάೖͱͯ͠ʙ ܀ྛ݈ଠ(.01FQBCP *OD ,3VCZ lLFOLFOJ[FzͰ৮ΕΔ3VCZͷத
(.0ϖύϘגࣜձࣾ ܀ྛ݈ଠBLB͋ΜͪΆͪΌΜ औక$50ɺࣛࣇౡΦϑΟενʔϜऀ IUUQTLFOUBSPLPSH
࣍ ࣄͷൃ LFOLFOHFNͷઆ໌ LFOLFOHFNͷ࣮ ͓ΘΓʹ
ࣄͷൃ
LFOLFOʹಥવ;ͬͯΘ͍ͨةػ ࣛࣇౡΦϑΟενʔϜʹLFOLFOͱ͍͏໊͋ͩͷΤϯδχΞ͕͍Δͷ͕ͩɺ ಥવͷվ໊ఏҊʹΑΔ໊͋ͩͷةػʂʂ̍
LFOLFOΛकΕʂʢʣ ·͋ɺͦ͏ͳΓ·͢ΑͶʜʜɻ
LFOLFOΛकΕʂʢʣ স͍ͷઈ͑ͳ͍ΞοτϗʔϜͳ৬Ͱ͢ɻ
LFOLFOΛकΕʂʢʣ ᰜͱݱΕΔΘͨ͘͠ͷఏҊɻ
lLFOLFOJ[Fzͷཁ݅ wཁ݅ ken ^ 2͕จࣈྻkenkenΛฦ͢ wͨͩ͠ɺม ken ʹจࣈྻken ͕ೖͬͯͯɺͦΕ͕ϝιου ^
ʹΑΓO ճ܁Γฦ͞ΕΔͱ͍͏࣮ͩͱͭ·Βͳ͍Ͱ͢ΑͶ wͦ͜Ͱɺมʹ͍͔ͳΔจࣈྻ͕ೖ͍ͬͯͯɺม໊Λnճ܁Γฦ͢͜ͱͰ ཁ݅Λຬͨ͢ίʔυʹ͍ͨ͠ɻ͜ͷॲཧΛlLFOLFOJ[FzͱݺͿɻ ͋ͳͨͳΒͲ͏͠·͔͢ʁߟ͑ͯΈ͍ͯͩ͘͞ɻ
LFOLFOHFNͷઆ໌
IUUQTHJUIVCDPNLFOUBSPLFOLFO
LFOLFOHFNͷ͍ํʢʣ
LFOLFOHFNͷ͍ํʢʣ จࣈྻ͕ͳΜͰ͋Δ͔ʹؔΘΒͣɺ ม໊͔Β܁Γฦ͢จࣈ͕ܾఆ͞ΕΔ
ཁ݅ͷ֬ೝ 㾎ཁ݅ ken ^ 2͕จࣈྻkenkenΛฦ͢ 㾎ͨͩ͠ɺม ken ʹจࣈྻken ͕ೖͬͯͯɺͦΕ͕ϝιου ^
ʹΑΓO ճ܁Γฦ͞ΕΔͱ͍͏࣮ͩͱͭ·Βͳ͍Ͱ͢ΑͶ 㾎ͦ͜Ͱɺมʹ͍͔ͳΔจࣈྻ͕ೖ͍ͬͯͯɺม໊Λnճ܁Γฦ͢͜ͱ Ͱཁ݅Λຬͨ͢ίʔυʹ͍ͨ͠ɻ͜ͷॲཧΛlLFOLFOJ[FzͱݺͿɻ ཁ݅ΛຬͨͤͨʂLFOLFOͷ໊͕͋ͩकΒΕͨʂʂ̍
LFOLFOHFNͷ࣮
LFOLFOHFN࣮ͷίΞʢൈਮʣ
eval͢Δ࣌ʹ3VCZͷ෦Ͱى͍ͬͯ͜Δ͜ͱʜᶃ 1BU4IBVHIOFTTZ 3VCZ6OEFSB.JDSPTDPQF"O*MMVTUSBUFE(VJEFUP3VCZ*OUFSOBMT /P4UBSDI1SFTT QQ
eval͢Δ࣌ʹ3VCZͷ෦Ͱى͍ͬͯ͜Δ͜ͱʜᶄ 1BU4IBVHIOFTTZ 3VCZ6OEFSB.JDSPTDPQF"O*MMVTUSBUFE(VJEFUP3VCZ*OUFSOBMT /P4UBSDI1SFTT QQ
LFOLFOHFN࣮ͷಓے wᶃͷྫ͔Β weval ͢Δͱɺ৽͍͠ελοΫϑϨʔϜ͕࡞͞ΕΔ wͦͷελοΫϑϨʔϜ͔ΒɺEPΛ௨ͯ͡ݩͷจ຺ͷมΛࢀরͰ͖Δ wᶄͷྫ͔Β wbindingΛ௨ͯ͡ɺݺͼग़͞ΕͨϝιουͷมΛࢀরͰ͖Δ wͭ·ΓɺbindingΛऔಘ͑͞Ͱ͖ΕɺͦͷٯͰ͖Δʹҧ͍ͳ͍ wϝιουݺͼग़͠ݩͷbindingΛ௨ͯࣗ͡ͷม໊ΛऔಘͰ͖Δͣʂ
LFOLFOHFN࣮ͷίΞͷղઆ ᶃݱࡏͷϑϨʔϜͷ;ͨͭ ্ͷbindingΛऔಘ ᶄᶃͷϑϨʔϜ্ͷϩʔΧ ϧมҰཡΛऔಘ ᶅᶄͰऔಘͨ͠ม໊Λᶃ ্ͰධՁ͠ɺΛಘΔ ᶆᶅͰಘͨͱࣗࣗ selfΛൺֱɻಉ͡ͳΒɺ ͦΕ͕తͷมͰ͋Δɻ
binding#of_callerϝιουɺCJOEJOH@PG@DBMMFSHFNʹΑͬͯՃ͞ΕͨϝιουͰɺίʔϧελοΫΛ͔͞ͷ΅ͬͯCJOEJOHΛऔಘͰ͖Δɻ
͓ΘΓʹ
·ͱΊͱิ wٕज़͕ͻͱΓͷਓؒͷ໊͋ͩΛकͬͨʂਖ਼͕࣮ٛߦ͞Εͨʂʂ̍ wݴޠͷ෦࣮ʹؔ͢ΔΠϝʔδ͕͋Δͱɺൃͷ෯͕͕Δʢ͔ʣ weval+bindingɺ͜͜Ͱղઆ͠ͳ͔ͬͨModule#class_eval BasicObject#instance_evalΛ͏ͱɺݱࡏͷίϯςΩετΛ͋Ε͜ ΕมߋͰ͖Δ w3VCZͰϝλϓϩάϥϛϯάΛ͍ͯ͠Δ߹ɺͦ͏͍͏ख๏Λ༻͍͍ͯΔ͜ͱ ͕ଟ͍ͷͰɺ͓ͬͯ͘ͱίʔυϦʔσΟϯάͷʹཱͭ ˞ࢀরͨ͠ॻ੶ץߦͷͨΊɺ࠷৽ͷ3VCZʹ͓͍ͯ෦࣮͕ҧ͍ͬͯΔ͔͠Ε·ͤΜɻͦͷลͷ֬ೝɺࠓޙͷ՝ͱ͍͏͜ͱͰɻ