Get the latest tech news

Go Data Structures: Interfaces (2009)


Posted on Tuesday, December 1, 2009. Go's interfaces—static, checked at compile time, dynamic when asked for—are, for me, the most exciting part of Go from a language design point of view.

As a warmup, a value of type Binary is just a 64-bit integer made up of two 32-bit words (like in the last post, we'll assume a 32-bit machine; this time memory grows down instead of to the right): In contrast, the implementation of this program in a dynamic language like Smalltalk (or JavaScript, or Python, or ...) would do the method lookup at line 4, which in a loop repeats needless work. Of course, this being a blog post, I don't have any numbers to back up this discussion, but it certainly seems like the lack of memory contention would be a big win in a heavily parallel program, as is being able to move the method lookup out of tight loops.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of interfaces

interfaces

Photo of data structures

data structures

Related news:

News photo

Go Data Structures (2009)

News photo

Gamedev in Lisp. Part 2: Dungeons and Interfaces

News photo

Intents: The Endgame for Computing Interfaces?