3 ms·
My book Crafting Interpreters has a similar snippet style where it shows you the surrounding context for inserted code so you can see where it goes. It doesn't
by munificent 5y ago
My book Crafting Interpreters has a similar snippet style where it shows you the surrounding context for inserted code so you can see where it goes. It doesn't show the deleted code (because that would probably get too noisy in most cases), but I could if I wanted to.
I ended up writing a whole little custom build system to automatically generate the snippets and their surrounding context based on comments in the source code [1]. It was a fairly complex program to write, but it makes it completely automatic and error-free. I can't imagine trying to maintain it all manually.
[1]: http://journal.stuffwithstuff.com/2020/04/05/crafting-crafting-interpreters/ http://journal.stuffwithstuff.com/2020/04/05/crafting-crafti...