Re: ERROR: Endless loop when referencing a slot

From: Gerald Klix <gklix_at_fred.hassler.net>
Date: Wed, 06 Nov 1996 23:05:26 +0100

Clifford Beshers wrote:

> It doesn't send my STk into an infinite loop, but it does cause it to
> fail with:
>
> *** Error:
> slot-ref: bad instance: 1
>
> Your funky eval statements seem to modify the local environment,
> rather than adding to it. I executed this modification:
>
> (define-class <tc0> ()
> ((my-slot :init-keyword :slot)))
>
> (format #t "OK 1.~%")
>
> (let ((dummy (make <tc0> :slot 'shit)))
> (format #t "OK 2.~%")
> (format #t "\n\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n");
> (display (environment->list (the-environment)))
> (format #t "\n\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n");
> (eval
> '(define tv0
> (begin
> (eval '(define tv1 1) (the-environment))
> 0))
> (the-environment))
> (format #t "Before loop.~%")
> (format #t "\n\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n");
> (display (environment->list (the-environment)))
> (format #t "\n\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n");
> (slot-ref dummy 'my-slot)
> (format #t "Never get here.~%")
> dummy)
>
> In the output of the first environment display, dummy has an expected
> value:
>
> (((dummy . #[<tc0> 40020fcc])) ...
>
> After the evals, the environment looks kind of strange:
>
> (((dummy . 1) (tv0 . 0))
>
> Somehow, dummy gets set to the value of tv1. This certainly seems
> like a bug to me. The fact that I get one error and you get an
> infinite loop suggests to me that there is some memory that is not
> initialized properly.

I suppose you are right.
It seems to be a bug in the implementation of eval. This simplified
version also crashes STk:

(format #t "OK 1.~%")

(let ((dummy 3))
  (format #t "OK 2.~%")
  (eval
   '(define tv0
      (begin
        (eval '(define tv1 1) (the-environment))
        0))
   (the-environment))
  (format #t "Before loop.~%")
  (display dummy)
  (format #t "Never get here.~%")
  dummy)

Changing "(display dummy)" to "(display (environment->list
(the-environment))" makes
STK to run out of memory:

*** Error:
    Out of storage
Current eval stack:
__________________
  0 WARNING: report-error is buggy!!

*** Error:
    Out of storage
Current eval stack:

etc. pp.


Now some questions:
Which STk version do you use?
Which os do you use?
The TK version is not relevant.
Snow also loopes.

The nested eval statements, acctually result from two macro
expansions, just has the whole let expression does.

Gerald
Received on Wed Nov 06 1996 - 23:00:57 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST