Hacker News new | past | comments | ask | show | jobs | submit login

It has been a while since I looked at it, but I was impressed by Russ Cox's implementation of channels in the LibThread library of Plan 9. All channel operations including blocking on several channels and selecting one that is ready, are described by Alt structures, which under the hood implement a simple but elegant algorithm that appears in Rob Pike's "The Implementation of Newsqueak." I feel you want to understand roughly how Go channels works, read that paper and look at LibThread's channel implementation.

A second choice would not be so much code, but an algorithm: Thompson constructions for regular expressions.




Yeah, the blocking select on multiple channels inside an infinite for { } struck me as the coolest construct in Go. It's like a little nerve centre.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: