Crafting Interpreters 2020-07-27

By Max Woerner Chase

Yesterday, I worked out a general plan for getting the resolver written, and today I started working on it. I didn't get too far on the actual resolver bit, because I got somewhat hung up on some jank in the typing system while laying the groundwork for it, and then I got just a few visitor methods implemented before I realized that I'd implemented function calls slightly wrong, and I'll either need to fix them, or replicate the breakage in the resolver. I figured I'd rather fix the implementation, because the wrongness is basically a case of unintentionally diverging from JLox, as opposed to all of the intentional divergences.

One area where I'm not diverging, for now, is in maintaining the shadowing behavior. The behavior is justified with "Shadowing is rare and often an error so initializing a shadowing variable based on the value of the shadowed one seems unlikely to be deliberate." That rings a little false to me, but maybe that's just because I've read so many Rust tutorials. In any case, I'm keeping the behavior of "error on shadow" for now, because the name of a local cannot be visible to consumers, which means that allowing shadowing doesn't open up expressiveness, so I'll stick with what the book says, for once. (Although, this post indicates that I'm going for at least twice, but whatever.)

I'll probably take a different tack with the language concept sketches that I'll hopefully be working on next week, but that's then and this is now. And now is late.

Good night.