Skip to content

Print evaluated procedure values as #<procedure> #85

Description

@pmatos

Deferred from #82: evaluated procedure values print as an empty string instead of a procedure representation.

Original feedback by @chatgpt-codex-connector on PR #82 (#82):

Print case-lambda closures
When a case-lambda value is returned instead of immediately applied, such as (linklet () () (case-lambda ((x) x))), interpretation produces a CaseLambdaClosure and main prints it through ValueNode::write(). This override is empty, so the program emits only the trailing newline instead of the procedure representation provided by CaseLambda::write(), making procedure-valued results disappear.

Context: In src/ASTRuntime.cpp, both CaseLambdaClosure::write() (line 84) and Closure::write() (line 45) are empty, whereas the AST nodes CaseLambda::write() / Lambda::write() (src/AST.cpp) print #<procedure>. src/main.cpp:76 prints the top-level result via Result->write() — and an evaluated procedure is always a closure value, so its (empty) writer runs. Consequently a bare top-level lambda or case-lambda prints only a newline.

Why deferred: scope-creep — the empty CaseLambdaClosure::write() is exact parity with the pre-existing Closure::write(), so PR #82 introduces no case-lambda-specific regression. The correct fix gives both Closure and CaseLambdaClosure a #<procedure> representation together; changing only the case-lambda writer would create a new inconsistency between the two procedure kinds, and the shared fix touches pre-existing lambda printing, which is outside the scope of an issue titled "Interpret case-lambda".

Filed automatically by pm-autofix-pr after dual-evaluator triage by Claude Opus 4.8 and Codex.

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