Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Opaque Result Type in Swift with Rust
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Takuma Shimizu
March 27, 2019
Programming
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Opaque Result Type in Swift with Rust
Takuma Shimizu
March 27, 2019
More Decks by Takuma Shimizu
See All by Takuma Shimizu
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
200
Swift Attributes
hokuron
0
480
Peek in Calendar implementation of swift-foundation
hokuron
0
270
MVVM
hokuron
0
84
Summon Rust from Swift
hokuron
0
730
Generalized accessors
hokuron
0
93
Ownership of Swift as seen from iteration and Rust
hokuron
1
750
Clean Architecture 3
hokuron
0
76
Clean Architecture 2
hokuron
0
99
Other Decks in Programming
See All in Programming
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
250
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.2k
Java 27新機能 / Java 27 new features
kishida
2
190
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
260
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
4
450
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
9.3k
Verilogで学ぶCPU自作入門.pdf
uyuki234
7
3.9k
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.2k
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
140
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
160
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
140
Featured
See All Featured
Navigating Team Friction
lara
192
16k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Designing for Performance
lara
611
70k
The Limits of Empathy - UXLibs8
cassininazir
1
690
Everyday Curiosity
cassininazir
0
340
Embracing the Ebb and Flow
colly
88
5.2k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
How to make the Groovebox
asonas
2
2.5k
Fireside Chat
paigeccino
43
4k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Transcript
Opaque Result Type in Swift with Rust
『Swift 5.1 に導入されそうな Opaque Result Type と は何か』 https://qiita.com/koher/items/338d2f2d0c4731e35 08f
リバースジェネリクス 通常のジェネリクス func useAnimal<A: Animal>(_ animal: A) { animal.foo() }
メソッド名に型引数を宣言 引数で型変数を利用 呼び出し側が型引数に対応する具象型を決定
リバースジェネリクス リバースジェネリクス func makeAnimal() -> <A: Animal> A { return
Cat() } メソッドシグネチャの後に型引数を宣言 返却値の型が型変数 実装側が型引数に対応する具象型を決定
Opaque Result Type some Animal を 返却値の型として利用 → リバースジェネリクス メソッド引数として利用
→ 通常のジェネリクスと同義 !!????
ジェネリクス func useAnimal<A: Animal>(_ animal: A) ↓ 型システム的な表現にすると ∀ A.
(func(A: Animal) -> ()) Opaque type func useAnimal(_ animal: some Animal) ↓ 型システム的な表現にすると (∃ A. A: Animal) -> ()
∀ A. (func(A: Animal) -> ()) ターンエーガンダムみたいななんかよく分からん記号 が、メソッドの引数から返却値まで全体にかかってい る。 (∃
A. A: Animal) -> () カタカナの「ヨ」みたいななんかよく分からん記号 は、出現場所( メソッド引数) だけにかかっている。 A. A: Animal の部分は一致している
つまり ∀ A. (func(A: Animal) -> ()) ⇔ (∃ A.
A: Animal) -> () という関係が成り立つ。 メソッド引数として利用した場合、通常のジェネリク スと同義 → 同じではないが、同形をとる
なぜプロトコル型に パフォーマンス上のロスがあるのか
Demo with Rust