Download Firefox: WindowsMac OS X
logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

[ sisc-Bugs-1509504 ] fatal error in letrec: msg#00003

Subject: [ sisc-Bugs-1509504 ] fatal error in letrec
Bugs item #1509504, was opened at 2006-06-20 19:51
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1509504&group_id=23735

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 7
Submitted By: Matthias Radestock (mradestock)
Assigned to: Nobody/Anonymous (nobody)
Summary: fatal error in letrec

Initial Comment:
Dan reported the following problem:

  (define (vec-rev-for-each p v)
    (define l (length v))
    (do ((i (- l 1) (- i 1))) ((< i 0) #t)
      (p i (vector-ref v i))))

#;> (vec-rev-for-each '#(1 2 3) values)
Exception in thread "Thread-2"
java.lang.ArrayIndexOutOfBoundsException: 1
        at sisc.env.LexicalUtils.fixLexicals(Unknown
Source)
        at sisc.exprs.LetrecExp.eval(Unknown Source)
        at
sisc.interpreter.Interpreter.interpret(Unknown Source)
        at
sisc.interpreter.Interpreter.interpret(Unknown Source)
        at sisc.interpreter.Interpreter.eval(Unknown
Source)
        at sisc.data.SchemeThread.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:595)

I subsequently found a shorter example:

(define (letrec-bug v p)
  (letrec ([l (length v)])
    (p l)))
(letrec-bug '#() #f)

Replacing 'length' with another prim produces the same
error. Replacing it with a non-prim produces the
correct result i.e. a Scheme level error.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1509504&group_id=23735


<Prev in Thread] Current Thread [Next in Thread>