[plt-scheme] strange bug in EOPL (v4.0.x)

From: Eric Tanter (etanter at dcc.uchile.cl)
Date: Sun Jul 6 04:08:34 EDT 2008

Hi,

The following program:

(define newcounter
  (lambda()
      (let ((c 0))
        (lambda(f)
             (begin
               (set! c (f c 1))
               c)))))

(define inc (lambda(x) (x +)))
(define cont (newcounter))
(inc cont)
(inc cont)

gives:
1
2

in Pretty Big, and in EOPL (v372), which is what one would expect.

But strangely enough, in EOPL under v4.0.1 and v4.0.2, it gives:
2
4

Any idea what's going on?

Thanks,

-- Éric

Posted on the users mailing list.