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
GoのUnderlying typeについて
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
matumoto
November 04, 2023
Technology
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GoのUnderlying typeについて
2023/11/04 に行われた会津大学 学祭LTの資料です
イベントページはこちら
https://zli.connpass.com/event/298894/
matumoto
November 04, 2023
More Decks by matumoto
See All by matumoto
Go標準パッケージのI/O処理をながめる
matumoto
0
420
testingを眺める
matumoto
1
210
sync/v2 プロポーザルの 背景と sync.Pool について
matumoto
0
770
Goトランザクション処理
matumoto
1
83
いまいちどスライスの 挙動を見直してみる
matumoto
0
410
Go1.22のリリース予定の機能を見る
matumoto
0
87
Typed-nilについて
matumoto
0
380
GoのType Setsという概念
matumoto
0
54
GoのRateLimit処理の実装
matumoto
0
490
Other Decks in Technology
See All in Technology
AI駆動開発を通して感じた、 AI時代のデザイナーの役割変化
whisaiyo
4
2.3k
Lightning近況報告
kozy4324
0
200
自宅LLMの話
jacopen
1
660
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
170
【Cyber-sec+】経営層を"動かす"ための考え方
hssh2_bin
0
200
2026年6月23日 Syncable Tech + Start Python Club にて
hamukazu
0
140
200個のGitHubリポジトリを横断調査したかった
icck
0
140
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
9
2k
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
150
気軽に使える"情報のハブ"としてのNotion活用 〜フロー情報の集積点 と、 Claude Code × Notion AI〜
syucream
1
160
AIのReact習熟度を測る
uhyo
2
650
AIAU_UMEMOGU_ninomiya_slide
ninomiya_ii
0
240
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
480
Abbi's Birthday
coloredviolet
2
8.1k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
390
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
950
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
320
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
850
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Deep Space Network (abreviated)
tonyrice
0
210
Practical Orchestrator
shlominoach
191
11k
Transcript
GoのUnderlying typeとは? どんなもの?なに? 彼女はいるの?調べてみました! 2023/11/04 学祭LT matumoto
• 学年:28期 • 趣味: ◦ マイクラ ◦ PokemonSleep ◦ VTuber
▪ 叶 ▪ やしきず • Twitter:@matumoto_1234 • ひとこと:マイクラに生活を破壊された matumoto 松本 響輝 自己紹介
Goの文法おさらい
Goの型エイリアス • type B = A でAを元にエイリアスを宣言できる
Goの型定義 • type B A でAを元に型を定義できる
型定義した型へのメソッド
関数とジェネリクス • 関数に型パラメータを取らせることができる
ジェネリクスの型制約 • 型パラメータに対して、型制約をかけることができる • 下のPrint関数の型引数にはintかstringしか渡せない
型制約のapproximation element • ~Tという文法で型Tを元にした型として、型制約の要素に使える
型制約のapproximation element • MyIntなどintを元にした型を渡すことができる
本題
Underlying typeとは? • 代入可能性やジェネリクスにおいての重要な概念 • すべての型はunderlying typeをちょうど一つ持つ
underlying の意味 •
例 • MyIntのunderlying typeはint
例 • intのunderlying typeはint
4つのルールによって決まる
クイズ
クイズ • MyMyStringのunderlying typeは?
正解 • 型定義はunderlying typeを共有するので、正解はstring
クイズ • struct{ x int }のunderlying typeは?
正解 • 型リテラルのunderlying typeはそれ自身
クイズ • MyIntsのunderlying typeは?
正解 • 型宣言はunderlying typeを共有するので、MyIntsのunderlying typeは[]MyIntの underlying type • 型リテラル[]MyIntのunderlying typeはそれ自身
• よって、MyIntsのunderlying typeは[]MyInt
いかがでしたか??? ありがとうございました