faiface blog

How to use 'try'

The recent try proposal by Robert Griesemer sparked a lot of controversy. While the proposal is a subject to reasonable criticism, I didn’t feel like everyone was always on the same page. This post isn’t pro-try or anti-try. It just shows how try could be used so that you can form a more informed opinion. Suppose we are grad students of social sciences and need to come up with idea for a poll.

How I built an audio library using the composite pattern and higher-order functions

Some people say that Go can’t express good abstractions. They mostly refer to the lack of generics. That’s because in most object-oriented languages, people are used to creating abstractions around types. In Go, the right way is to create abstractions around behaviour using interfaces. When you follow this principle, you find that Go is very powerful at creating abstractions. In this post, I am going to explore a way of creating abstractions using the ‘good old composite pattern’ from the book called ‘Design patterns’.

Context should go away for Go 2

As usual, when a new blog post comes out on blog.golang.org, I’m all eager to read it as soon as possible. The most recent one, Contributors Summit, is a nice write-up on the issues that the Go contributors have been talking about. While reading it, I stumbled upon a sentence that made me write this post. Here is is: For instance, it would be nice if io.Reader accepted a context so that blocking read operations could be canceled.