Ensmallening Go binaries by prohibiting comparisons
https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons [dave.cheney.net]
2020-05-09 18:00
tags:
compiler
go
programming
In this post I’ll dig into what equality, in the context of a Go program, means and why changes like this have a measurable impact on the size of a Go program.
Addendum: thanks to Brad’s prodding, Go 1.15 already has a bunch of improvements by Cherry Zhang and Keith Randall that fix the most egregious of the failures to eliminate unnecessary equality and hash functions (although I suspect it was also to avoid the proliferation of this class of CLs).
Dynamically scoped variables in Go
https://dave.cheney.net/2019/12/08/dynamically-scoped-variables-in-go [dave.cheney.net]
2019-12-12 06:56
tags:
go
programming
testing
type-system
What we want is to be able to access a variable whose declaration is neither global, or local to the function, but somewhere higher in the call stack. This is called dynamic scoping. Go doesn’t support dynamic scoping, but it turns out, for restricted cases, we can fake it.
Go compiler intrinsics
https://dave.cheney.net/2019/08/20/go-compiler-intrinsics [dave.cheney.net]
2019-08-22 05:33
tags:
benchmark
cpu
go
perf
programming
Over the years there have been various proposals for an inline assembly syntax similar to gcc’s asm(...) directive. None have been accepted by the Go team. Instead, Go has added intrinsic functions1.
An intrinsic function is Go code written in regular Go. These functions are known the the Go compiler which contains replacements which it can substitute during compilation.
Typed nils in Go 2
https://dave.cheney.net/2017/08/09/typed-nils-in-go-2 [dave.cheney.net]
2019-02-18 21:36
tags:
go
programming
type-system
This is an experience report about a gotcha in Go that catches every Go programmer at least once. The following program is extracted from a larger version that caused my co-workers to lose several hours today.
You’ve probably realised the cause of this problem is the dreaded typed nil, a gotcha that has its own entry in the Go FAQ. The typed nil emerges as a result of the definition of a interface type; a structure which contains the concrete type of the value stored in the interface, and the value itself.
Typed nils are an entirely logical result of the way dynamic types, aka interfaces, are implemented, but are almost never what the programmer wanted.
The linked post is a good read as well: https://research.swtch.com/interfaces
What Have We Learned from the PDP-11?
https://dave.cheney.net/2017/12/04/what-have-we-learned-from-the-pdp-11 [dave.cheney.net]
2017-12-11 04:37
tags:
hardware
photos
programming
retro
systems
This year represents the 60th anniversary of the founding of the company that produced the PDP-11. It is also 40 years since this paper was written, so I thought it would be entertaining to review Bell’s retrospective through the lens of our own 20/20 hindsight.
source: Dfly
The HERE IS key
https://dave.cheney.net/2017/08/21/the-here-is-key [dave.cheney.net]
2017-08-21 18:54
tags:
hardware
retro
tty
Not to be confused with the you are here key.
source: L