News for hackers. Stuff that matters.
Re:Crafting Interpreters: Calls and Functions by danso on Thursday July 25, 2019 @09:55AM (#20525367)
I love it so far and can't wait to buy it, even as I've gone through what you've posted so far. I was curious about your rate of progress in this phase (and over the past years). Have you found the rate of progress (the demands of job and real life aside) on the book to be relatively constant? Are the final chapters significantly harder to draft and write based on complexity? (as a relative layperson, I'm assuming describing the design and implementation of garbage collection is more involved than for common data structures)
Re:Crafting Interpreters: Calls and Functions by munificent on Thursday July 25, 2019 @10:30AM (#20525649)
The difficulty of the chapters themselves is almost perfectly flat. I wrote every single line of code for the book and split it out into chapters before I started writing any prose. I can tell you, today, exactly which lines of code need to be explained in the very last chapter, and I could have done that three years ago when I started writing the text for chapter one. (In fact, if you clone the repo and run the build script, you can see for yourself.)

Writing did get somewhat harder when I transitioned from part 1 (the Java interpreter) to part 2 (the C VM). C is a more finicky language in a lot of ways. Things like the order of declarations matter. So figuring out which order to introduce snippets of code within a single chapter tends to take a little longer, but it's not a big difference.

My rate of progress has generally slowed over the past few years, for a lot of reasons. My initial enthusiasm has naturally waned. There isn't much novelty left in the project for me — writing each chapter is much like writing the previous one. So it's mostly an exercise in discipline now. Meanwhile, of course, I keep stumbling into other new things that I am excited about, so staying focused is hard.

The last few years have also been personally difficult for me in a number of ways. My mother got cancer (in remission now!), two family members died, two friends died, my dog (the one on the back cover of my previous book) was in ill health for a long time and then had to be put down. Lots of other personal stuff like that. 2018 was one of the worst years of my life, even though I'm still very fortunate in many ways.

But through all of that, I've managed to keep going. I work on the book every day, so I worked on it in the hospital waiting room while my mom got a CAT scan. I wrote a measly 59 words the night after we put down my dog. I wrote in the hotel before my friend's memorial service and on an airplane on the way back from my aunt's funeral.

In some ways, the project is a constant comfort in my life, and it's also taught me a lot about the power of perserverance and discipline. I'm really looking forward to it being done and taking a long break. But I'm also looking forward to seeing what I'll be able to do with this discipline next.

Re:Crafting Interpreters: Calls and Functions by danso on Thursday July 25, 2019 @12:21PM (#20526674)
Thank you for sharing. I'm glad to hear that you're getting some benefit from working on your book, on top of whatever satisfaction you get and deserve from helping and enlightening readers. 2018 was a struggle for me too – but nothing on the level of what you describe – and it hurt my productivity and enthusiasm. Your book has been for me as much an inspirational kick-in-the-pants example as it has been intellectually edifying.

It's interesting to hear how you had the code pegged down for this book at the start. The book definitely feels like the result of such considered and planned design. But one of the features I most appreciate in your book are your reflective asides, such as the Design Notes [0]. I also attempt that in my writing, but almost always end up dragging myself down rabbit holes, including rewriting/renaming/restructuring entire code scripts/snippets, if not the project codebases that I've drafted and refer to. Guess I can't delude myself into thinking such bikeshedding is inevitable for this kind of writing!

[0] "Logic versus History" https://craftinginterpreters.com/parsing-expressions.html#de...

"What's in a Name" https://craftinginterpreters.com/introduction.html#design-no...

Re:Crafting Interpreters: Calls and Functions by munificent on Thursday July 25, 2019 @12:48PM (#20526958)
> 2018 was a struggle for me too

One of the things I tell myself is that many of these very difficult experiences were also growing ones for me. I, of course, would prefer that the friends and family I lost or who got sick were still here and healthy. But I also have a greater empathy and understanding when I interact with other people going through these same tribulations.

> It's interesting to hear how you had the code pegged down for this book at the start. The book definitely feels like the result of such considered and planned design.

I basically had to write it this way. My previous book was like a recipe book where each chapter is relatively unconnected so I could just start writing. But this book walks through two complete implementations of the same language, which I also designed for the book. So just about any tiny change to anything can affect very distant chapters.

I wasn't even sure if the book would hang together until I designed the language and wrote the code. If I couldn't get to a little toy language I liked or if the implementations had been a sprawling mess, I would have passed on the project. But a couple months in, everything kind of clicked and I realized I basically had to the write the book. It's like the thing was already there and I was just responsible for putting it all down on paper.

> I also attempt that in my writing, but almost always end up dragging myself down rabbit holes, including rewriting/renaming/restructuring entire code scripts/snippets, if not the project codebases that I've drafted and refer to.

I do a lot of that too. Fortunately, having the code pinned down helps. I basically can't touch the code now because doing so would destabilize existing chapters. The fact that I publish incrementally also keeps me from endlessly noodling.

But it is always a struggle to rein myself in and stay focused on making forward progress.

Re:Crafting Interpreters: Calls and Functions by ekez on Thursday July 25, 2019 @11:46AM (#20526375)
As someone who's been working through the book for the last few months, thanks so much for sticking with it. Your prose is excellent and full of really properly funny stuff sometimes. Reading your book has been my weekly dose of programming I know I'll enjoy.