The sample code is pretty interesting from a return value vs exception perspective: despite being forced to look at return values, the code still silently ignores all errors
bencode serialization is 800 lines!? I wrote under 50 in Smalltalk. In fact, I think it was less than half that. (To be fair, you can do this by adding recursive methods to Streams, which already have infrastructure to deal with the external environment.)