#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::Crafting Interpreters::Ch 22 Local Variables
#columns:Front	Back	Tags
Crafting Interpreters ch 22, Local Variables: what does it cover?	Local variables on the VM stack: the compiler tracks locals and scope depth, so each local is just a stack slot index, making access much faster than hash lookups.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::about
Crafting Interpreters ch 22, Local Variables: why does it matter?	This is how real compilers do register and stack slot allocation in simple form. It also explains why locals are faster than globals in Python and Lua.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::why
Crafting Interpreters ch 22, Local Variables: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::part
Crafting Interpreters ch 22: what traps should you watch for?	<ul><li>Popping the wrong number of locals at the end of a scope.</li><li>Reading a local in its own initializer must be an error.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::traps
Crafting Interpreters ch 22: which end-of-chapter challenges are worth your time?	Challenge 3 (const or final variables) and challenge 4 (more than 256 locals) are the implementable ones. Challenge 1 asks about faster local resolution.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::challenges
Crafting Interpreters ch 22, Local Variables: how should you work through it?	Use the disassembler to watch GET_LOCAL and SET_LOCAL slot numbers. Trace a nested block example on paper.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::22 cracked.guide::kind::approach
