Something I do not see often in programming language books is a concise explanation of semantic structures that are typically used. For example, in a Java method, there are different modifiers you can apply to the function to change how it behaves (public, private, static, etc.) Usually, the syntax is introduced and it is talked about at length, covering the many edge cases that might exist or the syntax is introduced in passing as an example requires a reader’s comprehension of the topic, referencing a later section for the explaination.

The syntax is important, but I also find it really boring to explain. In the book that I want to write about Go, I want to find a balance between introducing syntax and showing something that is interesting to play with further. Coding is unique in that as long as you have something that can compute near you (laptop, phone, tablet, heck, your watch) you can see something happen. I want to build a mental model quickly, and let people loose with examples to experiment with. Maybe some slider bars or knobs if you only have two brain cells to run together while reading.

Go’s syntax is so simple that you can introduce a lot very quickly. Here is how I would imagine introducing a struct:


// Define a struct named Person

type Person struct {

name string

age int


func main() {

// initialize a struct

person := Person{

name: “John”,

age: 30,



:= { : , …, }

// Access and print the fields of the person struct

println(“Name:”, person.firstName)

println(“Age:”, person.age)




Writing this out, it kind of feels like integrating BNF into examples. Run through the Go language spec and examples that run on the playground and you can cover a lot of ground quickly.