Nano-Blog : May 11, 2025
Nano-Blog for the week of May 11, 2025.
§ May 13, 2025 ![[QR Code]](IM/qr.png)
-
De Moura and Ierusalimschy's Paper on Coroutines
Coroutines have always been a little bit niche. They're quite useful for certain control or parsing tasks, but most programmers will more frequently use regular subroutines, if...else or for loop constructions. That's okay. You use what you're used to.
But if you have a few minutes, try reading this paper from Ana Lúcia De Moura and Roberto Ierusalimschy: Revisiting Coroutines. It's not "short", but it is interesting.
-
The Neco C Language Coroutine Library
Following on from an earlier post about coroutines in C, here is a link to the Neco Coroutine Library. It's clearly designed as a heavy-weight alterntative for people requiring serious I/O. Mostly I'm very happy to see numerous examples on their landing page. Well done.
§ May 12, 2025 ![[QR Code]](IM/qr.png)
-
Larry Wall's Quote About Programming Languages
Larry Wall has a great quote about programming languages:
Programming languages differ not so much in what they make possible, but in what they make easy.
The PERL programming language, invented by Wall, is an example of this quote in action. PERL programs make reading files one line at a time and searching for specific content fairly easy (at least compared to C.) But no one would be crazy enough to write an operating system in it.
-
Simon Tatham's Page About Coroutines in C
Coroutines are an extremely useful abstraction in modern programming. Like regular (sub)routines, they allow a programmer to compose complex tasks from smaller, simpler tasks. But unlike regular (sub)routines, control is passed between (usually) two routines until some exit condition is reached. You wouldn't want to use coroutines for everything, but when you need them, they're great to have in your toolbox of programming techniques.
As useful as they are, coroutines were not included as "first class abstractions" in the C Programming Language. Several people have noticed this lack and built a mix of preprocessor macros and library code to implement coroutines in C. One of the better tested implementations is described in Simon Tatham's page Philosophy of Coroutines. It's not a short read. But it's not long, either. It's well worth the time to read, digest and work through some examples.