2 ms·
The source code for the core of Putty is an astonishing construction, a sort of extreme case of Duff's device spanning many, many pages. At each point where an
by ncmncm 5y ago
The source code for the core of Putty is an astonishing construction, a sort of extreme case of Duff's device spanning many, many pages. At each point where an operation might block, there is a macro that expands to a break and a switch/case clause that enables returning to that point.
A colleague said "I love it, and hate myself for loving it".
The new "async/await" features appearing in numerous languages encode this pattern -- i.e., result in substantially the same object code -- in a more robust way, but Putty works fine.