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
Introduce Sub::Meta
Search
Kenta Kobayashi
May 21, 2021
Technology
0
45
Introduce Sub::Meta
Kenta Kobayashi
May 21, 2021
Tweet
Share
More Decks by Kenta Kobayashi
See All by Kenta Kobayashi
Tシャツに書かれたコードを読む
kfly8
0
1.2k
研修はイベントでなくコミュニティ作り
kfly8
0
1.2k
明日からできる新人のオンボーディングガイド
kfly8
0
780
メンター成長のためのふりかえり会
kfly8
0
1.2k
Interfaces in Perl5 at The Perl Conference 2019 in Pittsburgh
kfly8
0
2.9k
経験から効率よく学習する
kfly8
0
270
Interfaces in Perl5
kfly8
1
920
p5-Lodash!
kfly8
2
800
PPRとKeyword::Simpleと あとVariable::Declaration
kfly8
0
160
Other Decks in Technology
See All in Technology
JuliaTokaiとJuliaLangJaの紹介 for NGK2025S
antimon2
1
130
メンバーがオーナーシップを発揮しやすいチームづくり
ham0215
2
250
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
710
JAWS-UG20250116_iOSアプリエンジニアがAWSreInventに行ってきた(真面目編)
totokit4
0
150
今年一年で頑張ること / What I will do my best this year
pauli
1
230
My small contributions - Fujiwara Tech Conference 2025
ijin
0
1.5k
Formal Development of Operating Systems in Rust
riru
1
420
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!座学①
siyuanzh09
0
110
今から、 今だからこそ始める Terraform で Azure 管理 / Managing Azure with Terraform: The Perfect Time to Start
nnstt1
0
250
Evolving Architecture
rainerhahnekamp
3
260
駆け出しリーダーとしての第一歩〜開発チームとの新しい関わり方〜 / Beginning Journey as Team Leader
kaonavi
0
130
色々なAWSサービス名の由来を調べてみた
iriikeita
0
110
Featured
See All Featured
How to Ace a Technical Interview
jacobian
276
23k
Gamification - CAS2011
davidbonilla
80
5.1k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.8k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Statistics for Hackers
jakevdp
797
220k
Music & Morning Musume
bryan
46
6.3k
Mobile First: as difficult as doing things right
swwweet
222
9k
A Philosophy of Restraint
colly
203
16k
The Cost Of JavaScript in 2023
addyosmani
46
7.2k
Building Adaptive Systems
keathley
38
2.4k
Transcript
Introduce Sub::Meta kobaken a.k.a @kfly8 Perlͷ։ൃମݧΛྑ͍͖ͯ͘͠💪
ࣗݾհ • kobaken a.k.a @kfly8 • ϞόΠϧϑΝΫτϦʔ • ΤϯδχΞ৫։ൃऀ •
Ωʔϫʔυ: ODHDɺίʔνϯάɺ 1on1ɺDevOpsɺJobDescription • Japan Perl Association ཧࣄ • ࠷ۙɺ່̑ࡀʹUNOͰෛ͚Δ
Perlͷ։ൃମݧΛྑ͍ͨ͘͠💪
։ൃମݧʹ͔ܽͤͳ͍ • ڧྗͳΤϥʔνΣοΫ • ิ • ϑΥʔϚολ • ύϑΥʔϚϯε্ •
ͳͲ
ใ ߏจɾɾܕ औಘ ར༻
ใ ߏจɾɾܕ औಘ ར༻ PPI Compiler::Lexer PPR
ใ ߏจɾɾܕ औಘ ར༻ Perl::Critic Perl::Lint Perl::MinimumV ersion Perl::LanguageS erver
Spellunker::Pe rl
ใ ߏจɾɾܕ औಘ ར༻ RBS steep Sorbet RBI TypeProf ࢀߟɿhttps://techlife.cookpad.com/entry/2020/12/09/120454
ใ ߏจɾɾܕ औಘ ར༻ Sub::Meta
ใ ߏจɾɾܕ औಘ ར༻ Sub::Meta Types::TypedCodeRef Boundary Types::HasTypedMethods
খ·ͱΊ • PerlͰ։ൃମݧΛྑ͍͖ͯ͘͠💪 • ͦͷͨΊʹɺϓϩάϥϜ͔Βใ Λऔಘ͠ར༻͢ΔྲྀΕΛଊ͑Δ • Sub::Metaɺ͜ͷྲྀΕͰ͍͏ਅ ΜதͷཱͪҐஔ •
ؔͷϝλใΛར༻͘͢͠ ΔͨΊͷΦϒδΣΫτ܅
PerlͰؔͷϝλใΛ ѻ͏ͱ͖ͷࠞཚ ಛʹҾɺฦΓ
None
ؔaddͷϝλใ ໊ؔʁ add ύοέʔδʁ Foo Կߦ͔Βఆٛ͞Ε͍ͯΔʁ 3ߦ
use Sub::Identify; sub_name(\&add) # => add stash_name(\&add) # => Foo
my ($file, $line) = get_code_location(\&add)
my $meta = Sub::Meta->new( sub => \&add ); $meta->subname #
=> add $meta->stashname # => Foo $meta->line # => 3
ͰɺҾʁ
None
None
None
None
ࢁ͋ΔPerlͷ όϦσʔγϣϯϞδϡʔϧୡ
None
None
None
ҾόϦσʔγϣϯ܅͝ͱʹ ϝλใͷऔΓѻ͏ͷ໘
ใ ؔͷϝλ Sub::Meta Data::Validator Smart::Args Type::Params Function::Parameters Sub::WrapInType …
DEMO
ฦΓόϦσʔγϣϯ܅ ಉ༷ͷΞϓϩʔνͰղܾ
ใ ؔͷϝλ Sub::Meta Return::Type Function::Return Sub::WrapInType …
·ͱΊ • Perlͷ։ൃମݧΛྑ͍͖ͯ͘͠ 💪 • Sub::MetaɺؔͷҾɺฦ ΓؚΊͨϝλใΛ Sub::Metaʹू͠ɺ౷Ұతͳ ΠϯλʔϑΣʔεͰؔͷϝλ ใΛѻ͑ΔΑ͏ʹ͢Δ܅
ࠓޙʁ • Sub::MetaͷܕදݱΛ҆ఆͤ͞ Δ(issue #42) • Boundary ( Interface࣮ )ʹؔ
໊͚ͩͰͳ͘ɺฦΓɺҾ ͷܕՃຯ͢Δ #1 • Ruby3 steepͷΑ͏ͳ੩తͳ νΣοΧʔͷPoC