fix #73
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
seq-lisp-2-backport
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/seq-lisp!73
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bug-fix-lambda-syntax"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR Review
Summary
This PR bundles two unrelated changes: a bug fix in
eval-define-simpleand a design document for future multiline REPL history editing. These would be cleaner as separate PRs.src/eval.seq— Self-recursion fix fordefine+lambdaWhat it does: When
(define fact (lambda (n) ...))is evaluated, the unnamed closure is now promoted to a named closure (withself_name = "fact"). This mirrors whateval-define-functionalready does for the(define (fact n) ...)shorthand syntax — closing the gap between the two syntactic forms.Stack analysis looks correct. The sequence
sclosure-val → closure-params/body/env → 3 pick → make-named-closure → sclosurefaithfully rebuilds the closure with the bound name, and thenamed-closure? notguard correctly avoids double-promoting an already-named closure.Issues:
No test coverage for the fixed case.
tests/lisp/functions/recursion.slisponly tests(define (factorial n) ...)syntax. A test covering thedefine+lambdaform is missing:Without this, regression protection for the fix is absent.
Commit message and PR title are both just
"fix"— uninformative for anyone reading history. Something like"fix: enable self-recursion for (define name (lambda ...)) form"would be far more useful.PR body is empty. A one-line description of the bug and how it was triggered would help reviewers and future
git logreaders.Semantic note worth a comment: Promoting an anonymous closure to named when it is
defined is transparent for recursive use, but it alters the closure's observable identity (e.g. if closure names appear in error messages or introspection). This is almost certainly the right trade-off — matching the(define (f ...))shorthand — but a brief inline comment explaining why this promotion is safe would help future maintainers.docs/design/multiline-repl-history.md— Design docThe document is well-structured: it clearly identifies the current gap (flat cursor model vs. embedded-newline history entries), presents three design options for
j/ksemantics in tabular form, and justifies Option C (edge-aware fall-through to history) with a reasonable analogy to zsh/fish behavior. The phased approach and risk callouts in the LOE table are helpful.Minor points:
Overall
The eval fix is conceptually sound and consistent with how
eval-define-functionalready works. The main gap is missing test coverage for the exact bug being fixed. Please add a test inrecursion.slisp(orclosures.slisp) before merging.