On Aug 7, 2007, at 6:03 PM, Ivan Raikov wrote:


Hi all,

   It seems that the chicken compiler goes into an infinite loop (or
takes a really long time) when trying to compile the following code:


(require-extension datatype)

(define-constant Red 'Red)
(define-constant Black 'Black)

(define (color? x) (or (eq? x 'Red) (eq? x 'Black)))

(define-datatype tree tree?
  (Empty)
(Tree (color color?) (left tree?) (key identity) (value identity) (right tree?)))

(define (test root)
  (cases tree root
         (Empty ()  (Tree Red (Empty) key value (Empty)))
         (Tree (color a yk y b)  a)))


Removing the definitions of the constants Red and Black, or changing
their values to something other than 'Red and 'Black, respectively,
fixes the problem. I don't know enough about the implementation of the
datatype macros, but if this is not due to a bug in the macroexpansion
code, it would be nice if this situation can be automatically
detected.

Bug in macro expansion. Doesn't have anything to do w/ datatype. Because the constant value is a symbol it gets into an infinite loop w/ 'resolve-atom' & 'walk' mutually recursive.

Best Wishes,
Kon


        -Ivan


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users



_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to