letrec, letrec* and internal definition should raise an error if init part contains undefined variable

Create issue
Issue #127 resolved
Takashi Kato repo owner created an issue

The following script should all be invalid syntax

#!r6rs
(import (rnrs))

(define (foo bar)
  (define bar (cons 'a bar))
  (display bar) (newline))

(define (foo2 bar)
  (letrec ((bar (cons 'a bar)))
    (display bar) (newline)))

(define (foo3 bar)
  (letrec* ((bar (cons 'a bar)))
    (display bar) (newline)))

(foo 'b)
(foo2 'b)
(foo3 'b)

But all print (a).

NOTE: this may cause SEGV.

Comments (1)

  1. Log in to comment