On Sunday, October 2, 2016 at 7:40:10 AM UTC-5, Matthew Flatt wrote:
> Hi Scott,
>
> I didn't realize that you had deleted the old post, so I responded to
> it after all. I'm happy to update that reply in this thread.
>
> I think that you're seeing a bug in the current expander's marshaling
> of information for a compiled module. In your original program, the
> problem affects the "metadata.rkt" module that supplies
> `racquel-namespace`.
>
> As you note, the bug was introduced in recent versions. Specifically,
> it was introduced in v6.3 with the set-of-scopes expander. Happily, a
> re-implementation of the expander doesn't have the bug, but the
> re-implementation isn't quite ready to replace the current expander.
>
> I'll fix the bug as soon as I can. Meanwhile, if you'd like a
> workaround for your original program:
>
> The conflicting "lifted.0" is created in "metadata.rkt" by the contract
> system's expansion of `~a`. You can work around the problem by changing
>
> (~a col-fld)
>
> to
>
> (format "~a" col-fld)
>
> In your smaller version below, something similar should happen with
> `query-rows`. Even though the function is never called, the
> `query-rows` call syntactically triggers a contract expansion that
> introduces "lifted.0".
>
> More generally, the workaround is to use `define-namespace-anchor` in a
> module that does not call any functions with a contract via
> `racket/contract` (which is, of course, something you generally should
> not have to know or worry about).
>
> Matthew
>
> At Sat, 1 Oct 2016 21:01:05 -0700 (PDT), "'brown131' via Racket Users" wrote:
> > 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 ...)))
Thanks for the help! I'm impressed that you were able to find the issue so
quickly. I'm pretty sure that I wouldn't have found the answer, let alone have
known that the work around was so simple.
-Scott
--
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