Skip to content

chore(special-vars): complete polish tasks (Phase 8) #6

Description

@cxxxr

Summary

Complete the remaining polish tasks for the special variables implementation.

Branch: 002-special-vars-compiler
Spec: specs/002-special-vars-compiler/tasks.md (Phase 8)
Priority: P3 (polish)

Prerequisites

Tasks

From specs/002-special-vars-compiler/tasks.md:

  • T059: Update placeholder tests in tests/integration/special-var-test.lisp to real implementations
  • T060: Add UNBOUND check code generation option to compile-special-var-ref
  • T061: Integration test for closure capturing special variable in tests/integration/special-var-test.lisp

Details

T059: Update Placeholder Tests

Current tests for US4/US5 are placeholders that always pass. Once US4 and US5 are implemented, these need to be converted to real integration tests.

T060: UNBOUND Check

Add optional UNBOUND sentinel checking when accessing special variables:

  • Generate code to check if symbol-value equals UNBOUND sentinel
  • Signal an error for unbound variable access
  • Make this configurable (for performance vs safety trade-off)

T061: Closure + Special Variable Test

Test the interaction between closures and special variables:

(defvar *x* 10)
(let ((f (lambda () *x*)))
  (let ((*x* 20))
    (funcall f)))  ; Should return 20 (dynamic binding)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions