Slide 1

Slide 1 text

Day #1 - Type System Overview Concepts regarding the Go type system 「 Trying to make you to fall in love with Golang 」 1 / 7 Type System Overview Luca Sepe Software Craftsman, Solution Architect, Trainer https://twitter.com/lucasepe/ https://github.com/lucasepe/ https://lucasepe.it/

Slide 2

Slide 2 text

Basic Types built-in string type: string built-in boolean type: bool built-in numeric types: int8 , uint8 ( byte ), int16 , uint16 , int32 ( rune ), uint32 , int64 , uint64 , int , uint , uintptr float32 , float64 complex64 , complex128 「Trying to make you to fall in love with Golang」 - Type System Overview 2 / 7 Type System Overview Luca Sepe Software Craftsman, Solution Architect, Trainer https://twitter.com/lucasepe/ https://github.com/lucasepe/ https://lucasepe.it/

Slide 3

Slide 3 text

Composite Types pointer, struct and function types container types: array types - fixed-length container types slice type - dynamic-capacity container types map types - associative arrays (or dictionaries) channel types - used to synchronize data among goroutines interface types - key role in reflection and polymorphism 「Trying to make you to fall in love with Golang」 - Type System Overview 3 / 7 Type System Overview Luca Sepe Software Craftsman, Solution Architect, Trainer https://twitter.com/lucasepe/ https://github.com/lucasepe/ https://lucasepe.it/

Slide 4

Slide 4 text

Type Definitions We can define new types by using the type keyword. the new defined type and the source type will share the same underlying type their values can be converted to each other types can be defined within function bodies 「Trying to make you to fall in love with Golang」 - Type System Overview 4 / 7 Type System Overview Luca Sepe Software Craftsman, Solution Architect, Trainer https://twitter.com/lucasepe/ https://github.com/lucasepe/ https://lucasepe.it/

Slide 5

Slide 5 text

Zero Value Concept An instance of a type is called a value of the specific type . each type has a zero value that can be viewed as the default value Try It! 「Trying to make you to fall in love with Golang」 - Type System Overview 5 / 7 Type System Overview Luca Sepe Software Craftsman, Solution Architect, Trainer https://twitter.com/lucasepe/ https://github.com/lucasepe/ https://lucasepe.it/

Slide 6

Slide 6 text

Zero Value Concept if we don't specify a value for this type it will be set to this zero value Boolean false Integer 0 Floating Point 0 Complex 0 + 0i String "" (empty string) Pointer nil 「Trying to make you to fall in love with Golang」 - Type System Overview 6 / 7 Type System Overview Luca Sepe Software Craftsman, Solution Architect, Trainer https://twitter.com/lucasepe/ https://github.com/lucasepe/ https://lucasepe.it/

Slide 7

Slide 7 text

Thank you Luca Sepe Solution Architect (@day) / Software Craftsman (@night) {twitter.com, github.com, linkedin.com} / lucasepe 「Trying to make you to fall in love with Golang」 - Type System Overview 7 / 7 Type System Overview Luca Sepe Software Craftsman, Solution Architect, Trainer https://twitter.com/lucasepe/ https://github.com/lucasepe/ https://lucasepe.it/