Opened 7 years ago
Closed 7 years ago
#1421 closed defect (invalid)
problems with building json egg in c5 egg repo
Reported by: | felix winkelmann | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 5.0 |
Component: | expander | Version: | 5.0.0 |
Keywords: | Cc: | sjamaan | |
Estimated difficulty: | hard |
Description
Building the json egg results in:
Error: (json.scm:109) - toplevel definition of `white' in non-toplevel context
The code looks like this:
(define parser (packrat-parser (begin (define (white results) ...
Changing the begin
to let ()
results in another, more obscure error.
Apparently the proper treatment of define
inside begin
inside let
is not correctly expanded (packrat-parser
seems to expand into a let body).
Change History (3)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
On second thought, it looks like this inner let
that is the source of t59
is introduced by the compiler (through ##sys#canonicalize-body
), so I'm not 100% sure it is packrat doing things wrong...
comment:3 Changed 7 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
OK never mind, this was a complete red herring. The json egg didn't work because it contained use
instead of import
expressions, causing the packrat-parser
call to be seen not as a module but as a procedure call, which means the define
s were indeed "misplaced".
I believe this is a bug in how packrat works:
Compiling this with
csc -debug 2
produces:As you can see, the expansion of the internal define of json would look something like:
This is clearly incorrect: you can't put
define
in the value expression of a let-variable.