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
Android の公式 Skill / Android skills
yanzm
0
160
【Cyber-sec+】経営層を"動かす"ための考え方
hssh2_bin
0
200
2026TECHFRESH畢業分享會 - Lightning Talk - E起 See See : 電商推薦讀心術? 數據說了算
line_developers_tw
PRO
0
1.3k
ザ・データベース、MySQL ~ OSC 2026 Sendai ~
sakaik
0
140
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
190
20260619 私の日常業務での生成 AI 活用
masaruogura
1
230
あなたの知らないPDFのアクセシビリティ
lycorptech_jp
PRO
0
220
AIのReact習熟度を測る
uhyo
2
650
AWS Security Hub CSPMの成功・失敗体験
cmusudakeisuke
0
270
SONiCのLinuxベースを活かしたZabbix監視
sonic
0
230
PostgreSQL 19 新機能概要 OSC Hokkaido 2026
nori_shinoda
0
150
データレイクの「見えない問題」を可視化する
sansantech
PRO
1
110
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
250
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
970
How to Ace a Technical Interview
jacobian
281
24k
Designing for Performance
lara
611
70k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
340
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Technical Leadership for Architectural Decision Making
baasie
3
420
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
290
YesSQL, Process and Tooling at Scale
rocio
174
15k
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
いかがでしたか??? ありがとうございました