SlideShare a Scribd company logo
1 of 79
Go generics
What is this fuss about?
Why we need generics?
Why we need generics?
● Reduce the programmers overhead
● Increase code maintenance
● Increase type safety
● Reduce number of errors
● Make code faster
Why we need generics?
● Generic Data Structures
● Generic Algorithms
● Higher-order functions
● ….
y:= make([]T, len(list))
for i, x := range list {
y[i] = fn(x)
}
seq.Map(list, fn)vs
parallel.Map(list, fn) vs seq.Map(list, fn)
Why Go doesn't have generics (yet)?
“Generics are a technical issue and are not a political one.
The Go team is not against generics per se, only against
doing things that are not well understood and/or don't work
well with Go.”
- Russ Cox
Source: https://news.ycombinator.com/item?id=9622417
Generics Draft Design!
“(...) the design can be fully backward
compatible with Go1.”
Source: https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md
“Among other languages
that support parametric polymorphism
this design is perhaps most similar to CLU or Ada.”
Source: https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md
Type parameters
func PrintTimes(s []interface{}, t int)
func PrintTimes(s []T, t int)
“In a language like Go, we expect
every identifier to be declared in some way.”
Source: https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md
func PrintTimes(s []T, t int)
func PrintTimes(s []T, t int)
func PrintTimes(s []T, t int)
func PrintTimes (s []T, t int)
func PrintTimes(type T)(s []T, t int)
PrintTimes(int)([]int{1, 2, 3}, 3)
PrintTimes(int)([]int{1, 2, 3}, 3)
PrintTimes(int)([]int{1, 2, 3}, 3)
PrintTimes ([]int{1, 2, 3}, 3)
PrintTimes ([]int{1, 2, 3}, 3)
“Type inference is a convenience feature.
Although we think it is an important feature, it does not add
any functionality to the design, only convenience in using it.”
Source: https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md
Does Go1 has a type inference?
var res *http.Response
var err error
res, err = http.Get("http://brainly.com/")
res, err := http.Get("http://brainly.com/")
How to declare more than one
type parameter?
func Print2(type T1, T2)(s1 []T1, s2 []T2)
Let’s look at map function
func Map(type T1, T2)(s []T1, f func(T1) T2) []T2 {
r := make([]T2, len(s))
for i, v := range s {
r[i] = f(v)
}
return r
}
func Map(type T1, T2)(s []T1, f func(T1) T2) []T2 {
r := make([]T2, len(s))
for i, v := range s {
r[i] = f(v)
}
return r
}
func Map(type T1, T2)(s []T1, f func(T1) T2) []T2 {
r := make([]T2, len(s))
for i, v := range s {
r[i] = f(v)
}
return r
}
s := []int{1, 2, 3}
slices.Map(s, func(i int) float64 {
return float64(i)
})
Parameterized types
type List struct {
next *List
val interface{}
}
type List(type T) struct {
next *List(T)
val T
}
func (l *List(T)) Val() T {
return l.val
}
l := list.List(int)
l.Append(1)
l.Tail().Val() == 1
Parameterized type aliases
type Ptr(type Target) = *Target
var i *int = &1 // Error!
j := 1
var i *int = &j // OK!
type Ptr(type Target) = *Target
var i *int = Ptr(int)(1)
type Ptr(type Target) = *Target
type PtrInt = Ptr(int)
var i *int = PtrInt(1)
Contracts
func PrintTimes(type T)(s []T, t int) {
for _, n := range s {
fmt.Print(n.String())
}
}
func PrintTimes(type T)(s []T, t int) {
for _, n := range s {
fmt.Print(n.String())
}
}
func PrintTimes(type T)(s []T, t int) {
for _, n := range s {
fmt.Print(n.Stringer())
}
}
PrintTimes(data, 3)
^^^^
Error: SomeStruct doesn’t have String() method,
Stringer() expected.
“(...) Go is designed to support programming at scale”
Source: https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md
contract stringer(x T) {
var s string = x.String()
}
func PrintTimes(type T stringer)(s []T, t int) {
for _, n := range s {
fmt.Print(n.Stringer())
}
}
func PrintTimes(type T stringer)(s []T, t int) {
^^^^^^^^^^
Error: PrintTimes does not follow contract
stringer. String() method call expected.
Contract vs Interface?
Source: https://twitter.com/rogpeppe/status/1036008488143646722
contract stringer(x T) {
var s string =
x.String()
}
type stringer interface {
String() string
}
vs
Source: https://gist.github.com/deanveloper/c495da6b9263b35f98b773e34bd41104
type Comparable interface {
operator[==]
operator[!=]
}
What contract can contract?
contract convert(t To, f From) {
To(f)
From(t)
f == f
}
contract strseq(x T) {
[]byte(x)
T([]byte{})
len(x)
}
contract G(n Node, e Edge) {
var _ []Edge = n.Edges()
var from, to Node = e.Nodes()
}
contract add1K(x T) {
x = 1000
x + x
}
contract iterable(x T) {
for T {}
}
Reflection
reflect.TypeOf(&List(int)).String()
=== "List(int)"
Efficiency
“do you want slow programmers, slow compilers and
bloated binaries, or slow execution times?”
- Russ Cox
Source: https://research.swtch.com/generic
“Only experience will show
what people expect in this area.”
Source: https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md
Omissions
Omissions
● No metaprogramming
● No covariance or contravariance.
● No operator methods (range, ==, m[k])
● No currying
● ...
What do you think about draft design?
vs
Thanks!
Gabriel Habryn
GitHub: github.com/widmogrod
Twitter: @widmogrod
Brainly Jobs: https://brainly.co/jobs.html
“(...) the type parameters are bounded not by a subtyping
relationship but by explicitly defined structural
constraints”
Source: https://go.googlesource.com/proposal/+/master/design/go2draft-contracts.md
Go generics. what is this fuzz about?

More Related Content

What's hot

[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...Mumbai B.Sc.IT Study
 
ASP.NET With C# (Revised Syllabus) [QP / October - 2016]
ASP.NET With C# (Revised Syllabus) [QP / October - 2016]ASP.NET With C# (Revised Syllabus) [QP / October - 2016]
ASP.NET With C# (Revised Syllabus) [QP / October - 2016]Mumbai B.Sc.IT Study
 
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...Mumbai B.Sc.IT Study
 
[Question Paper] Computer Graphics (Revised Course) [April / 2015]
[Question Paper] Computer Graphics (Revised Course) [April / 2015][Question Paper] Computer Graphics (Revised Course) [April / 2015]
[Question Paper] Computer Graphics (Revised Course) [April / 2015]Mumbai B.Sc.IT Study
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesDudy Ali
 
構文や語彙意味論の分析成果をプログラムとして具現化する言語 パターンマッチAPIの可能性
構文や語彙意味論の分析成果をプログラムとして具現化する言語パターンマッチAPIの可能性構文や語彙意味論の分析成果をプログラムとして具現化する言語パターンマッチAPIの可能性
構文や語彙意味論の分析成果をプログラムとして具現化する言語 パターンマッチAPIの可能性kktctk
 
[Question Paper] E-Commerce (Old Course) [September / 2013]
[Question Paper] E-Commerce (Old Course) [September / 2013][Question Paper] E-Commerce (Old Course) [September / 2013]
[Question Paper] E-Commerce (Old Course) [September / 2013]Mumbai B.Sc.IT Study
 
Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...Salar Delavar Qashqai
 
C mcq practice test 4
C mcq practice test 4C mcq practice test 4
C mcq practice test 4Aman Kamboj
 
Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...Salar Delavar Qashqai
 
[Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013]
[Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013][Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013]
[Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013]Mumbai B.Sc.IT Study
 
Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]
Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]
Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]Mumbai B.Sc.IT Study
 
Pythonとはなんなのか?
Pythonとはなんなのか?Pythonとはなんなのか?
Pythonとはなんなのか?Atsushi Shibata
 
[Question Paper] Computer Graphics (Old Course) [September / 2013]
[Question Paper] Computer Graphics (Old Course) [September / 2013][Question Paper] Computer Graphics (Old Course) [September / 2013]
[Question Paper] Computer Graphics (Old Course) [September / 2013]Mumbai B.Sc.IT Study
 
Visualizing Symbolic Execution with Bokeh
Visualizing Symbolic Execution with BokehVisualizing Symbolic Execution with Bokeh
Visualizing Symbolic Execution with BokehAsankhaya Sharma
 

What's hot (19)

[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
 
ASP.NET With C# (Revised Syllabus) [QP / October - 2016]
ASP.NET With C# (Revised Syllabus) [QP / October - 2016]ASP.NET With C# (Revised Syllabus) [QP / October - 2016]
ASP.NET With C# (Revised Syllabus) [QP / October - 2016]
 
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
[Question Paper] Object Oriented Programming With C++ (Revised Course) [June ...
 
[Question Paper] Computer Graphics (Revised Course) [April / 2015]
[Question Paper] Computer Graphics (Revised Course) [April / 2015][Question Paper] Computer Graphics (Revised Course) [April / 2015]
[Question Paper] Computer Graphics (Revised Course) [April / 2015]
 
C++ day2
C++ day2C++ day2
C++ day2
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference Types
 
C++ training day01
C++ training day01C++ training day01
C++ training day01
 
構文や語彙意味論の分析成果をプログラムとして具現化する言語 パターンマッチAPIの可能性
構文や語彙意味論の分析成果をプログラムとして具現化する言語パターンマッチAPIの可能性構文や語彙意味論の分析成果をプログラムとして具現化する言語パターンマッチAPIの可能性
構文や語彙意味論の分析成果をプログラムとして具現化する言語 パターンマッチAPIの可能性
 
Clojure
ClojureClojure
Clojure
 
[Question Paper] E-Commerce (Old Course) [September / 2013]
[Question Paper] E-Commerce (Old Course) [September / 2013][Question Paper] E-Commerce (Old Course) [September / 2013]
[Question Paper] E-Commerce (Old Course) [September / 2013]
 
Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...Pushover 2order (p delta effect) analysis force analogy method with force con...
Pushover 2order (p delta effect) analysis force analogy method with force con...
 
C mcq practice test 4
C mcq practice test 4C mcq practice test 4
C mcq practice test 4
 
Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...Pushover analysis of frame by force analogy method with force control based o...
Pushover analysis of frame by force analogy method with force control based o...
 
[Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013]
[Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013][Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013]
[Question Paper] ASP.NET With C# (60:40 Pattern) [October / 2013]
 
Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]
Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]
Geographic Information System (May – 2016) [75:25 Pattern | Question Paper]
 
Pythonとはなんなのか?
Pythonとはなんなのか?Pythonとはなんなのか?
Pythonとはなんなのか?
 
Module 2 topic 2 notes
Module 2 topic 2 notesModule 2 topic 2 notes
Module 2 topic 2 notes
 
[Question Paper] Computer Graphics (Old Course) [September / 2013]
[Question Paper] Computer Graphics (Old Course) [September / 2013][Question Paper] Computer Graphics (Old Course) [September / 2013]
[Question Paper] Computer Graphics (Old Course) [September / 2013]
 
Visualizing Symbolic Execution with Bokeh
Visualizing Symbolic Execution with BokehVisualizing Symbolic Execution with Bokeh
Visualizing Symbolic Execution with Bokeh
 

Similar to Go generics. what is this fuzz about?

To GO or not to GO
To GO or not to GOTo GO or not to GO
To GO or not to GOsuperstas88
 
Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015Aysylu Greenberg
 
Inroduction to golang
Inroduction to golangInroduction to golang
Inroduction to golangYoni Davidson
 
[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GIS
[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GIS[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GIS
[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GISMinPa Lee
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Raffi Khatchadourian
 
Google Cluster Innards
Google Cluster InnardsGoogle Cluster Innards
Google Cluster InnardsMartin Dvorak
 
Declarative Semantics Definition - Term Rewriting
Declarative Semantics Definition - Term RewritingDeclarative Semantics Definition - Term Rewriting
Declarative Semantics Definition - Term RewritingGuido Wachsmuth
 
Eclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDT
Eclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDTEclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDT
Eclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDTElena Laskavaia
 
Company_X_Data_Analyst_Challenge
Company_X_Data_Analyst_ChallengeCompany_X_Data_Analyst_Challenge
Company_X_Data_Analyst_ChallengeMark Yashar
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoRodolfo Carvalho
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMRaveen Perera
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow규영 허
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojurePaul Lam
 
Dynamics in graph analysis (PyData Carolinas 2016)
Dynamics in graph analysis (PyData Carolinas 2016)Dynamics in graph analysis (PyData Carolinas 2016)
Dynamics in graph analysis (PyData Carolinas 2016)Benjamin Bengfort
 

Similar to Go generics. what is this fuzz about? (20)

go.ppt
go.pptgo.ppt
go.ppt
 
To GO or not to GO
To GO or not to GOTo GO or not to GO
To GO or not to GO
 
Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015
 
Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Inroduction to golang
Inroduction to golangInroduction to golang
Inroduction to golang
 
[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GIS
[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GIS[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GIS
[FOSS4G Seoul 2015] New Geoprocessing Toolbox in uDig Desktop GIS
 
Golang dot-testing-lite
Golang dot-testing-liteGolang dot-testing-lite
Golang dot-testing-lite
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
 
Google Cluster Innards
Google Cluster InnardsGoogle Cluster Innards
Google Cluster Innards
 
Generative adversarial text to image synthesis
Generative adversarial text to image synthesisGenerative adversarial text to image synthesis
Generative adversarial text to image synthesis
 
Declarative Semantics Definition - Term Rewriting
Declarative Semantics Definition - Term RewritingDeclarative Semantics Definition - Term Rewriting
Declarative Semantics Definition - Term Rewriting
 
Golang
GolangGolang
Golang
 
Eclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDT
Eclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDTEclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDT
Eclipse Con 2015: Codan - a C/C++ Code Analysis Framework for CDT
 
Company_X_Data_Analyst_Challenge
Company_X_Data_Analyst_ChallengeCompany_X_Data_Analyst_Challenge
Company_X_Data_Analyst_Challenge
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojure
 
Dynamics in graph analysis (PyData Carolinas 2016)
Dynamics in graph analysis (PyData Carolinas 2016)Dynamics in graph analysis (PyData Carolinas 2016)
Dynamics in graph analysis (PyData Carolinas 2016)
 
Clojure basics
Clojure basicsClojure basics
Clojure basics
 

More from Gabriel Habryn

More from Gabriel Habryn (6)

Type theory in practice
Type theory in practiceType theory in practice
Type theory in practice
 
Interfejs konwersacyjny
Interfejs konwersacyjnyInterfejs konwersacyjny
Interfejs konwersacyjny
 
SaturnAnalytic
SaturnAnalyticSaturnAnalytic
SaturnAnalytic
 
Data grid w PHP
Data grid w PHPData grid w PHP
Data grid w PHP
 
Cappuccino Framework
Cappuccino FrameworkCappuccino Framework
Cappuccino Framework
 
Jak żyć zdrowo
Jak żyć  zdrowoJak żyć  zdrowo
Jak żyć zdrowo
 

Recently uploaded

The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 

Recently uploaded (20)

The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 

Go generics. what is this fuzz about?

Editor's Notes

  1. This adds overhead for the programmers and it can be error-prone to implement a single thing multiple times. Of course the re-implemented and copy-pasted code needs to be maintained. Similarly to code-generation this suffers from potential code-bloat. type-casts that could cause errors The reflection adds overhead and some type-casts may still be necessary.
  2. Don’t need to re-implement hard-to-get-right structures. Sets, Trees, Graphs,... You need to write code only to your specific needs and not the generic part. Sequential to concurrent with fewer changes in code Mutation of state by mistake in the input structs is much less likely to happen in functional code
  3. However, type parameters are not the same as non-type parameters, so although they appear in the parameters we want to distinguish them.
  4. However, type parameters are not the same as non-type parameters, so although they appear in the parameters we want to distinguish them.
  5. However, type parameters are not the same as non-type parameters, so although they appear in the parameters we want to distinguish them.
  6. However, type parameters are not the same as non-type parameters, so although they appear in the parameters we want to distinguish them.
  7. Since Print has a type parameter, when we call it we must pass a type argument. Type arguments are passed much like type parameters are declared: as a separate list of arguments. At the call site, the type keyword is not used.
  8. We’ve dealt with generic functions What about generic data structures?
  9. Parameterized types
  10. Parameterized types
  11. Parameterized types
  12. Parameterized types
  13. We’ve dealt with generic functions What about generic data structures?
  14. Parameterized types
  15. Parameterized types
  16. Parameterized types
  17. Parameterized types
  18. Parameterized types
  19. We’ve dealt with generic functions What about generic data structures?
  20. If the function is called with a type that does not have a String method, the error is reported at the point of the function call. These errors can be lengthy, as there may be several layers of generic function calls before the error occurs, all of which must be reported for complete clarity.
  21. Millions LOC Hundreds of programers developing codebase
  22. Millions LOC Hundreds of programers developing codebase
  23. Millions LOC Hundreds of programers developing codebase
  24. We’ve dealt with generic functions What about generic data structures?
  25. Parameterized types
  26. We’ve dealt with generic functions What about generic data structures?
  27. We’ve dealt with generic functions What about generic data structures?