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
「ちゃんとした」パターンマッチとは?
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
hirunebot
August 06, 2026
7
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
「ちゃんとした」パターンマッチとは?
PHP の match 式では「ちゃんとした」パターンマッチができないそうなので、Rust の match 式と比較してみるLT資料です。
hirunebot
August 06, 2026
Featured
See All Featured
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
670
Un-Boring Meetings
codingconduct
0
390
A Soul's Torment
seathinner
6
3.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Designing for Timeless Needs
cassininazir
1
450
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
900
Side Projects
sachag
455
43k
Documentation Writing (for coders)
carmenintech
77
5.5k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
490
Transcript
「ちゃんとした」パターンマッチとは? 昼寝bot 2026/8/5 CTOA若手エンジニアコミュニティ LT会 26年8月会
自己紹介 ・植松 歩 ・昼寝bot(@HiRuNe_bot_) ・株式会社カカクコム ・求人ボックスのWeb開発 ・JS、PHP ・最近 研修が終わった
PHP の match 式
パターンにマッチしてそう
None
「ちゃんとした」パターンマッチ ???
Rust ・関数型言語から強く影響されている ・パターンマッチあり ・強そう →Rustのパターンマッチを見てみよう
PHPのmatchと同じことができる
PHPのmatchではできないこと
PHPのmatchではできないこと
何が違うのか? ・Rust のパターンマッチでは、値と pattern を照合する ・値が pattern に合致するか判定 ・値の構造を分解 ・取り出した値を変数に束縛
・PHP の match が行うのは、基本的に値の一致判定(===) ・値の構造を分解できない ・分解した値を変数に束縛できない
まとめ ・同じ match でも、PHP と Rust ではかなり違う ・「ちゃんとした」パターンマッチ =パターンとの照合を通じて、単なる一致判定 だけでなく、値の分解や変数への束縛ができる
仕組み