Live data from Hacker News

Crafting Interpreters: Closures

craftinginterpreters.com

61–62 of 62 posts

Re: Crafting Interpreters: Closures

#61
post #51

Earlier quoted context omitted.

Another approach is to do the opposite - always store all local variables in the heap, and rely on scalar replacement of aggregates to put them back onto the stack where possible. This is what I do in my Ruby interpreter. That’s definitely not compatible with a single-pass though!

A third option that can still be single pass is the Smalltalk way, where the stack frames themselves are first-class objects: the closures then keep a reference to the stack frame and the GC won't collect any live stack frames, which will contain closed-over variables.

Yes that's really what I'm talking about, but plus the (really required for practical performance) optimisation of virtualising the frames onto the stack if they don't escape an activation.

Re: Crafting Interpreters: Closures

#62
post #16

Small piece of ui/ux feedback. It would be awesome if you moved the next and previous buttons to a static position so I can quickly page through the book. Right now they hop up and down.

Thanks for mentioning that. I notice this too and it bugs me. I've tried a few different layouts and positions for those navigation buttons and so far haven't found anything else I like better. My thinking at the time was that most readers aren't quickly paging through chapters so it's not a key affordance. I'll probably do some site tweaks after I finish the last chapter. In the meantime, the layout is quite respons…

Hey, thanks for listening to the feedback. Also, layout feedback aside, I love your book. <3
Post reply on HN