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
GoのUnderlying typeについて
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
matumoto
November 04, 2023
Technology
250
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
490
testingを眺める
matumoto
1
220
sync/v2 プロポーザルの 背景と sync.Pool について
matumoto
0
830
Goトランザクション処理
matumoto
1
94
いまいちどスライスの 挙動を見直してみる
matumoto
0
430
Go1.22のリリース予定の機能を見る
matumoto
0
98
Typed-nilについて
matumoto
0
400
GoのType Setsという概念
matumoto
0
64
GoのRateLimit処理の実装
matumoto
0
550
Other Decks in Technology
See All in Technology
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
自分で立ててみるLLMサービス
y_sera15
0
160
オブザーバビリティを高める AI エージェント体験を考える / Designing AI Agent Experiences That Enhance Observability
aoto
PRO
2
330
OSC2026on_the-world-is-waiting-for-your-voice.pdf
naruoga
0
370
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
360
More Freedom on the Same Shared GPU Cluster: A Small Team’s Experience with vCluster
nttcom
0
150
全PRの83%が AIレビューだけでマージできるようになった開発組織は その後どうなったか @2026/10
athug
0
140
Kiro Crewをはじめよう
kizawa2020
1
130
全人類(ほぼ)AWS Organizations の上でAWSを利用している、その世界を知る話
htan
1
130
ai_cording_with_k8s_knowledge.pdf
mochizuki875
1
330
生成AIを使って「人が」考える技術 ― AI時代の人機共想と実践ノウハウ|UNITT AC2026
ishiirikie
0
580
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.4k
Featured
See All Featured
Chasing Engaging Ingredients in Design
codingconduct
0
350
Six Lessons from altMBA
skipperchong
29
4.5k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
Building Adaptive Systems
keathley
44
3.2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Balancing Empowerment & Direction
lara
6
1.3k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
A Soul's Torment
seathinner
8
3.7k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
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
いかがでしたか??? ありがとうございました