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
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
480
testingを眺める
matumoto
1
220
sync/v2 プロポーザルの 背景と sync.Pool について
matumoto
0
820
Goトランザクション処理
matumoto
1
94
いまいちどスライスの 挙動を見直してみる
matumoto
0
430
Go1.22のリリース予定の機能を見る
matumoto
0
98
Typed-nilについて
matumoto
0
390
GoのType Setsという概念
matumoto
0
64
GoのRateLimit処理の実装
matumoto
0
550
Other Decks in Technology
See All in Technology
使いこなすために知っておきたい Azure SRE Agent アンチパターン
torumakabe
2
350
調査タスクをAIと乗り切る 〜過去の調査をナレッジ化し 調査手順をスキルにする〜
mot_techtalk
1
120
あなたの知らないAmazon VPC Route Server/Amazon VPC Route Server you don't know about
masakiokuda
2
220
Deep Data Security 機能解説
oracle4engineer
PRO
2
700
いちAWSエンジニアのAI活用を振り返る #devio2026 / devio osaka 2026 kawahara
masahirokawahara
2
380
AI時代に必要な脅威モデリング― 変化の速度に負けない理解とリスク判断
masakane55
4
980
AI時代だからこそ推したい!Gitコマンド再入門
munakata
0
150
SDDの運用にめげずに向き合った話
sansantech
PRO
0
130
オブザーバビリティを高める AI エージェント体験を考える / Designing AI Agent Experiences That Enhance Observability
aoto
PRO
2
310
並行性の問題を防げ!実践トランザクション入門
occhi
0
260
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
16
120k
[2026 Oracle Technical Deep Dive] Apache Iceberg × Oracle AI Database -Oracle Autonomous AI Lakehouseが実現するAI時代のデータ基盤- (2026年9月17日開催)
oracle4engineer
PRO
0
110
Featured
See All Featured
Navigating Team Friction
lara
192
16k
ラッコキーワード サービス紹介資料
rakko
1
5.2M
Building Flexible Design Systems
yeseniaperezcruz
330
41k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
260
Facilitating Awesome Meetings
lara
57
7.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
610
Embracing the Ebb and Flow
colly
88
5.2k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
450
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
910
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
いかがでしたか??? ありがとうございました