convert-closures "free vars encountered in program" error mistakenly happening
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ikarus Scheme |
Fix Released
|
Critical
|
Abdulaziz Ghuloum |
Bug Description
Sorry, I tried, but couldn't find a simpler way to reproduce this. I tried other snippets which do the same thing of binding an introduced gensym variable and referring to it to pass the value to a recursive use of the macro, and they all work. (srfi and-let) is pasted after the REPL session. I've marked the relevant syntax-case clause in the source code that is causing the problem.
Ikarus Scheme version 0.0.2patched+ (revision 1289, build 2007-12-25)
Copyright (c) 2006-2007 Abdulaziz Ghuloum
> (import (srfi and-let))
> (define x 123)
> (and-let* ([x])) ;;; This works
123
> (and-let* ([+]))
Unhandled exception
Condition components:
1. &error
2. &who: convert-closures
3. &message: "free vars encountered in program"
4. &irritants: ((#["var" #{var |gevcu2y dn\bo2nlD|} #f #t #f #f #f #f #f #f #f #f #f]) (begin '#<void> '#<void> + (if v:var + '#f)))
>
=======
(srfi and-let)
=======
(library (srfi and-let)
;; can't be named (srfi and-let*) because some OS's filenames can't have *
(export and-let*)
(import (rnrs))
(define-syntax and-let*
(lambda (stx)
(define (unique-ids? ls)
(or (null? ls)
(and (let notmem? ([x (car ls)] [ls (cdr ls)])
(define (get-and-check-ids clauses)
(let loop ([c* clauses])
[([var expr] . rest)
(or (identifier? #'var)
(cons #'var (loop #'rest))]
(loop #'rest)]
[()
;;; First check these
(syntax-case stx ()
[(_ (clause* ...) body* ...)
'ignore])
;;; Then construct output syntax
(syntax-case stx ()
[(_ (clause* ...) body* ...)
(define-syntax and-let*-core
(lambda (stx)
(syntax-case stx ()
[(kw ignore ([var expr] clause* ...) body* ...)
#'(let ([var expr])
(if var
(kw var (clause* ...) body* ...)
[(kw ignore ([expr] clause* ...) body* ...) ;;; <=== This one ***
#'(let ([g expr])
(if g
[(kw ignore (id clause* ...) body* ...)
(or (identifier? #'id)
#'(if id
(kw id (clause* ...) body* ...)
#f)]
[(kw last () body* ...)
(if (positive? (length #'(body* ...)))
#'(begin body* ...)
)
Changed in ikarus: | |
status: | Fix Committed → Fix Released |
Confirmed. This are simpler examples: (or + #f) or (let ([t +]) (if t t #f))