I am getting strange error in my Racquel package unit tests. I'm not sure what 
Racket release it started appearing in, but certainly 6.6 or 6.5. A couple of 
days ago, I posted the all of code that was causing the error, but there was 
too much going on for anyone to make sense of it (including me) and so I 
deleted the post. Now I've spent a few hours and reduced the bug to the minimum 
code required to reproduce it.

The error I'm seeing in my tests is:

define-values: assignment disallowed 
cannot re-define a constant
  constant: lifted.0

This error is rather obtuse and I have no I idea what it trying to communicate 
given that the code in question has no constant named "lifted". I can only 
assume that it is some internal error related to syntax lifting.

Below are the two modules needed to reproduce the error. What makes this error 
particularly strange is that the error occurs until the foobar function in 
bug2.rkt is commented out. This function is not even called anywhere!

Interestingly it must call query-rows. If foobar calls anything else, the bug 
goes away. This may mean that there is an error somewhere in the db package.

When the foobar function is commented out, everything works fine. In this 
example, for the sake of brevity, it will give an error that error-me% is 
undefined. I could have defined it and the other classes, and it would have ran 
with no errors.

The problem is that in the real version of the code, the foobar function is 
used and necessary. I can't just comment it out. Until I know what's going on 
here, I can't even devise a workaround. 

bug.rkt:
#lang racket

(require "bug2.rkt" (for-syntax racket/syntax syntax/parse "bug2.rkt"))

(define-syntax (data-class stx)
  (syntax-parse stx 
    [(_ base-cls:id (i-face:id ...) elem:data-class-element ...) 
     (with-syntax ([m-data (generate-temporary)])
       #'(let* ([m-data (new error-me%)])
           (class* base-cls (bar% i-face ...) 
             elem.cls-expr ...
             (inspect #f))))]))

(define (gen-data-class) 
  (let* ([cls-nm 'cls-nm]
         [stx #`(data-class object% (foo%) (super-new))])
    (eval-syntax stx bug-namespace)))

(define fred% (gen-data-class))

bug2.rkt:
#lang racket

(require syntax/parse db (for-syntax racket/syntax syntax/parse))

(provide (all-defined-out))

;;; Until this is commented-out the error persists.
(define (foobar con) (query-rows con ""))

(define-namespace-anchor bug-namespace-anchor)
(define bug-namespace (namespace-anchor->namespace bug-namespace-anchor))
         
(define-syntax-class data-class-element
  #:attributes (cls-expr)
  (pattern (x:expr ...)            
           #:attr cls-expr #'(x ...)))
 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to