liveBook · Manning

Functional, stateless philosophy

As explained in Go in Practice, Second Edition

Functional programming is a programming paradigm that emphasizes function composition, expressions, and controlled handling of state and side effects.

A functional, stateless philosophy treats functions as first-class values and favors functional-style techniques such as generic sequence operations. Go can support this style, but its idiomatic design emphasizes passing and retrieving state through concurrency patterns rather than pursuing functional aesthetics. section 3.2

Before Go 1.18, functions could be passed as values, but the lack of typed generic iterators limited reusable sequence operations across arbitrary types. Generics made functional-style Go more practical without making Go a functional language. section 3.2

How Go in Practice, Second Edition covers it

How deep it goes
Defines first-class functions and generic sequence operations, then stops at a pragmatic comparison rather than implementation guidance.
Examples
Uses generic sequence operations and Go’s pre-1.18 versus post-1.18 capabilities as contrastive examples.
What you can do after
Evaluate functional-style Go against idiomatic Go trade-offs.
How it connects
Connects functional programming to generics, first-class functions, concurrency, state, and object-oriented programming.

Also explained in

Compare how 19 books explain functional, stateless philosophy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Practice, Second Edition. The section links point to the parts of the book it draws on.