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
PPRとKeyword::Simpleと あとVariable::Declaration
Search
Kenta Kobayashi
March 03, 2018
Technology
0
140
PPRとKeyword::Simpleと あとVariable::Declaration
Kenta Kobayashi
March 03, 2018
Tweet
Share
More Decks by Kenta Kobayashi
See All by Kenta Kobayashi
Tシャツに書かれたコードを読む
kfly8
0
1.1k
Introduce Sub::Meta
kfly8
0
41
研修はイベントでなくコミュニティ作り
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
Other Decks in Technology
See All in Technology
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
46k
GC24 Recap: Interface Internals
task4233
0
150
「認証認可」という体験をデザインする ~Nekko Cloud認証認可基盤計画
logica0419
2
450
フルカイテン株式会社 採用資料
fullkaiten
0
32k
Functional TypeScript
naoya
11
4.8k
実務における脅威モデリングを考えよう
nikinusu
0
670
DroidKaigi 2024 たすけて!ViewModel
mhidaka
5
950
『GRANBLUE FANTASY: Relink』最高の「没入感」を実現するカットシーン制作手法とそれを支える技術
cygames
1
140
Classmethod AI Talks(CATs) #1 司会進行スライド(2024.09.19) / classmethod-ai-talks-aka-cats_moderator-slides_vol1_2024-09-19
shinyaa31
0
120
AIで変わるテスト自動化:最新ツールの多様なアプローチ/ 20240910 Takahiro Kaneyama
shift_evolve
0
240
20240912 JJUGナイトセミナー
mii1004
0
140
技術的負債解消の取り組みと専門チームのお話
bengo4com
0
340
Featured
See All Featured
Infographics Made Easy
chrislema
239
18k
Optimizing for Happiness
mojombo
375
69k
A Modern Web Designer's Workflow
chriscoyier
692
190k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
278
13k
Mobile First: as difficult as doing things right
swwweet
221
8.8k
RailsConf 2023
tenderlove
28
810
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.3k
The Art of Programming - Codeland 2020
erikaheidi
48
13k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
Designing Experiences People Love
moore
138
23k
Bash Introduction
62gerente
608
210k
Writing Fast Ruby
sferik
623
60k
Transcript
PPR と Keyword::Simple と あと Variable::Declaration YAPC::Okinawa 2018 / LT
@k y8
k y8 2 歳の娘の父になった モバファク JPA
agenda 1. PPR 2. Keyword::Simple 3. Variable::Declaration
PPR
PPR Perl の静的解析モジュー ル 類似モジュー ルは、PPI 正規表現を使った、 解析ができる Statement,Variable,Block,etc
PPR example use PPR; my $s = 'my $yapc:OKINAWA =
"OIST"'; print $s =~ m{ ((?&PerlAttributes)) $PPR::GRAMMAR }x; # => :OKINAWA
PPR pros/cons 意図はわかりやすく、 簡潔 意図通りに作るのが難しい( 主観) Perl が柔軟すぎて
Keyword::Simple
Keyword::Simple Pure Perl で Perl にキー ワー ド追加できる PL_keyword_plugin を利用
類似モジュー ル Devel::Declare Keyword::Declare
Keyword::Simple example package ExampleKeywordSimple; use Keyword::Simple; sub import { Keyword::Simple::define
'yapc' => sub { my $ref = shift; substr($$ref, 0, 0) = 'print " はいさい!";sub'; }; } 1; use ExampleKeywordSimple; yapc okinawa { } # => はいさい!
Keyword::Simple pros/cons Pure Perl で Perl を弄れる(2 回目) B::Deparse が手放せない(
主観) use ExampleKeywordSimple; BEGIN { $^H{'Keyword::Simple/keywords'} = 'HASH(0x7fc1b940a018)' } ; ; print " はいさい!"; sub okinawa { BEGIN { $^H{'Keyword::Simple/keywords'} = 'HASH(0x7fc1b940a018)' } }
PPR × Keyword::Simple Pure Perl で Perl を静的解析した結果を用いて Perl を拡張できる
Variable::Declaration
Variable::Declaration PPR × Keyword::Simple 変数宣言の拡張 use Type::Tie use Data::Lock
Variable::Declaration example use Variable::Declaration; use Types::Standard qw/Int/; let Int $foo
= 2018; $foo = 'YAPC'; # ERROR: Value "YAPC" did not pass type constraint "Int"
deparse example use Variable::Declaration; use Types::Standard ('Int'); use feature 'state';
BEGIN { $^H{'Keyword::Simple/keywords'} = 'HASH(0x7fc8de02e350)' } ; ; my $foo = 2018; croak(Int->get_message($foo)) unless Int->check($foo); ttie $foo, Int; $foo = 'YAPC';
Variable::Declaration pros/cons buggy ( v0.01 ) 静的型付き言語を使えば? と言われる
Thanks!!