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
410
“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
300
大高生へのメッセージ(令和6年度「大高未来塾」) / Messages to Current Students
kentaro
0
220
「始め方」の始め方 / How to Start Starting Things
kentaro
5
820
Dynamic IoT Applications and Isomorphic IoT Systems Using WebAssembly
kentaro
1
1.2k
わたしがこのところハマっている「ライセンスフリー無線」のご紹介 / An Invitation to License-Free Radio
kentaro
1
460
先行きの見えなさを楽しさに変える ーVUCA時代のキャリア論と絶対他力主義ー / How to develop your career in the VUCA era
kentaro
7
4.9k
組織の生産性を高める意思決定の構造と方法 / How to do make decision rapidly and effectively
kentaro
39
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.4k
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
Code Reviewing Like a Champion
maltzj
520
39k
Why Our Code Smells
bkeepers
PRO
334
57k
Navigating Team Friction
lara
183
14k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Docker and Python
trallard
40
3.1k
Building an army of robots
kneath
302
43k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
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ʹ͓͍ͯ෦࣮͕ҧ͍ͬͯΔ͔͠Ε·ͤΜɻͦͷลͷ֬ೝɺࠓޙͷ՝ͱ͍͏͜ͱͰɻ