Expand description
Escape analysis for zone safety.
Implements the “Hotel California” containment rule: values can enter zones but cannot escape. This pass checks for obvious violations before code generation, providing Socratic error messages.
§The Zone Rule
Variables defined inside a zone are deallocated when the zone ends. Returning or assigning them to outer variables would create dangling references. This pass catches these common patterns with friendly errors.
§Example
Zone "temp":
Let x be 5.
Return x. ← Error: x cannot escape zone "temp"§Limitations
More complex escape patterns (e.g., through closures or indirect references) are caught by Rust’s borrow checker at compile time. This pass catches the common cases with better LOGOS-specific error messages.
Structs§
- Escape
Checker - Tracks the “zone depth” of variables for escape analysis
- Escape
Error - Error type for escape violations