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
41
Introduce Sub::Meta
Kenta Kobayashi
May 21, 2021
Tweet
Share
More Decks by Kenta Kobayashi
See All by Kenta Kobayashi
Tシャツに書かれたコードを読む
kfly8
0
1.1k
研修はイベントでなくコミュニティ作り
kfly8
0
1.2k
明日からできる新人のオンボーディングガイド
kfly8
0
740
メンター成長のためのふりかえり会
kfly8
0
1.1k
Interfaces in Perl5 at The Perl Conference 2019 in Pittsburgh
kfly8
0
2.8k
経験から効率よく学習する
kfly8
0
250
Interfaces in Perl5
kfly8
1
880
p5-Lodash!
kfly8
2
780
PPRとKeyword::Simpleと あとVariable::Declaration
kfly8
0
140
Other Decks in Technology
See All in Technology
やってやろうじゃないかメカアジャイル! / Let's do it, mechanical agile!
psj59129
1
680
GC24 Recap: Interface Internals
task4233
0
150
DevRelの始め方
moongift
PRO
2
390
Agile in Automotive Industry, puzzles and lights.
hiranabe
3
1.4k
自作Cコンパイラ 8時間の奮闘
soukouki
0
850
スタッフエンジニアの道: The Staff Engineer’s Path
snoozer05
PRO
44
14k
より快適なエラーログ監視を目指して
leveragestech
4
1.5k
The XZ Backdoor Story
fr0gger
0
3.6k
技術的負債解消の取り組みと専門チームのお話
bengo4com
0
340
PdMはどのように全てのスピードを上げられるか ~ 非連続進化のための具体的な取り組み ~
sansantech
PRO
4
1.3k
プロダクトエンジニアを支えるための開発生産性向上施策
tsukakei
0
150
可視化により内部品質をあげるAIドキュメントリバース/20240910 Hiromitsu Akiba
shift_evolve
0
220
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
89
16k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
25
3.9k
Speed Design
sergeychernyshev
22
430
Building Adaptive Systems
keathley
36
2.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
How to Ace a Technical Interview
jacobian
274
23k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
Imperfection Machines: The Place of Print at Facebook
scottboms
263
13k
RailsConf 2023
tenderlove
28
810
Creatively Recalculating Your Daily Design Routine
revolveconf
215
12k
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