#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::Crafting Interpreters::Ch 21 Global Variables
#columns:Front	Back	Tags
Crafting Interpreters ch 21, Global Variables: what does it cover?	Statements and global variables in clox: print and expression statements, declarations, global variable get and set via the hash table, and assignment with correct precedence.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::about
Crafting Interpreters ch 21, Global Variables: why does it matter?	Shows how a single-pass compiler handles declarations and l-values, a trickier problem than in jlox.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::why
Crafting Interpreters ch 21, Global Variables: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::part
Crafting Interpreters ch 21: what traps should you watch for?	<ul><li>Invalid assignment targets silently accepted when canAssign is not threaded through correctly.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::traps
Crafting Interpreters ch 21: which end-of-chapter challenges are worth your time?	Challenge 1 (stop adding duplicate name constants) and challenge 2 (faster global lookup) are both good engineering exercises. Challenge 3 (REPL-friendly forward references) is a design puzzle.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::challenges
Crafting Interpreters ch 21, Global Variables: how should you work through it?	Pay attention to how the canAssign flag prevents invalid assignment targets. Test with expressions like a * b = c.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::21 cracked.guide::kind::approach
