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
Kotlinのリストのmap関数、自動生成されているって!
Search
RyotaMurohoshi
August 25, 2018
Technology
650
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kotlinのリストのmap関数、自動生成されているって!
2018年8月25日(土)のKotlin FestのLT資料です!
RyotaMurohoshi
August 25, 2018
More Decks by RyotaMurohoshi
See All by RyotaMurohoshi
Tilemapのアップデートについて
ryotamurohoshi
0
100
Unityの合同同人誌や合同商業誌を書いてる僕は感想やレビューや評価が欲しい
ryotamurohoshi
0
630
Unity 2021.1での Unityパッケージの名称変更について
ryotamurohoshi
0
920
Odin Validationはいいぞ!
ryotamurohoshi
2
1.1k
Tilemapはいいぞ!2020 〜すごいぞ、プロジェクト専用拡張Brush〜
ryotamurohoshi
0
2.6k
Unityでも、新しいC#
ryotamurohoshi
0
1.5k
Riderはいいぞ!
ryotamurohoshi
1
3.8k
Riderのススメ〜俺はRiderここが好き〜
ryotamurohoshi
1
2.8k
Unity開発者に伝えたい.NETのこと
ryotamurohoshi
4
38k
Other Decks in Technology
See All in Technology
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
700
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1k
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
140
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
140
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
690
ハードウェアコンペでもAI駆動開発が進んでいる話
iotengineer22
1
730
"優秀な誰か"の下位互換にならないために
yut0naga1_fa
1
1.8k
エンタメ企業のM&Aを支えるデータ基盤 ― 統合から店舗のリアルタイム分析まで / Data Engineering Summit 2026
genda
0
140
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
430
M5Stackで作る BLEマウス GPSログの世界
tomokusaba
0
390
フロントエンドカンファレンス関西2026 - 速すぎるUIに、待ち時間を
teamlab
PRO
0
110
Rust で関数型ドメインモデリング
takonda
0
120
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.6k
A better future with KSS
kneath
240
18k
Bash Introduction
62gerente
615
220k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
630
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
470
GraphQLとの向き合い方2022年版
quramy
50
15k
The Invisible Side of Design
smashingmag
301
52k
Transcript
Kotlinのリストのmap関数のコード 自動生成されてるって! @RyotaMurohoshi 2018/08/25(土) Kotlin Fest LT
Kotlin 1.3にて 符号なし整数値型が登場予定! ※現状はまだExperimental
ソースコードを覗いてみましょう! https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/stdlib/unsigned/src/kotlin
UInt
UShort
None
ほぼ一緒じゃん! ※ ここチョイ笑いするとこですよ
ところでちょっと気になるコメントに 気が付きましたか?
UInt
拡大すると・・・
ここ!!!
符号なし整数値型のコード 自動生成されてる! ※ ここ「へー」っていうことですよ!
`kotlin/generators`ディレクトリの `builtins/generateBuiltIns.kt`をみてね! https://github.com/JetBrains/kotlin/blob/v1.3-M1/generators/builtins/arrayIterators.kt `ranges`や`iterator`も生成されているよ!
ところで、Kotlinのstdlib・・・
https://github.com/JetBrains/kotlin/tree/1.2.60/libraries/stdlib Standard LibraryのReadMeには・・・
https://github.com/JetBrains/kotlin/tree/1.2.60/libraries/stdlib Standard LibraryのReadMeには・・・
そう、stdlibにも自動生成されたコードが! ※ ここ「へー」っていうことですよ!
どんなコードが自動生成されている? みんながよく使うアレも自動生成されている!
これ!map拡張関数! みんなが大好きリストのmap関数!
map拡張関数の実装も・・・? https://github.com/JetBrains/kotlin/blob/1.2.60/libraries/stdlib/common/src/generated/_Collections.kt#L1217
こいつも自動生成!!! ※ ここみんなが大きな声で「へー」っていうことですよ!
そう、mapもfilterも 実は、自動生成されているんです! ※ ここ”も”みんなが大きな声で「へー」っていうことですよ!
kotlin/libraries/tools/kotlin-stdlib-gen https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/tools/kotlin-stdlib-gen
kotlin/libraries/tools/kotlin-stdlib-gen https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/tools/kotlin-stdlib-gen Kotlinでのコード生成に興味があったら、読んでみて! @DslMarkerも利用した、コードジェネレータDSL! KDocも、DSLでいい感じに作っている!
kotlin/libraries/tools/kotlin-stdlib-gen https://github.com/JetBrains/kotlin/tree/v1.3-M1/libraries/tools/kotlin-stdlib-gen • `src/generators/GenerateStandardLib.kt`がエントリポイント • `src/templates/dsl`以下に、DSLのためのクラス群がある • `src/templates`以下に、DSLを利用したメソッドを実際に生成するクラス群
まとめ • Kotlinのコード、自動生成されているよ! • `kotlin/generators/builtins` • `kotlin/libraries/tools/kotlin-stdlib-gen` • stdlibのコード、DSLやコードジェネレーターの参考になるよ! •
ドメインがKotlinだから、他の知識なしでも理解が!
詳しくはブログで!
2018/08/25(土) Kotlin Fest LT @RyotaMurohoshi リストのmap関数のコード 自動生成されてるって!
時間が余ったのでみなさん大きな声で 「へーーー!」 って言っください! リストのmap関数のコード 自動生成されてるって!
Kotlinかわいい!