Summary
error using 'bindings' egg from an 'included' script
Metadata
- Id: 79ed24436e8345f7180cbf777e4c9a5294e8bd33
- Trac id: 1154
- Type: defect
- Reporter: retroj
- Owner: sjamaan
- Cc: retroj
- Status: closed
- Component: unknown
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: someday
- Version: 4.9.x
- Changetime: 2014-11-11 17:28:58 UTC
- Created: 2014-09-18 05:50:56 UTC
- Keywords:
Attachments
- 79ed24436e8345f7180cbf777e4c9a5294e8bd33/attachments/fix-bindings-for-compilation.diff
Description
The setup for this error is to have one script that includes another script, and the second script has (use bindings) and some use of the forms provided by the bindings egg. For example:
- test-case.scm
(import chicken scheme) (use extras) (include "script-that-uses-bindings.scm")
- script-that-uses-bindings.scm
(use bindings) (pp (bind (a b c) (list 1 2 3) (list c b a)))
run with: csi -s test-case.scm
This resulted in the following error:
Error: during expansion of (dbind21 ...) - unbound variable: macro-helpers#seq-destruc
Call history:
<syntax> (##core#require-extension (bindings) #t)
<syntax> (##core#begin (##core#begin (##core#begin (##sys#require (quote bindings))) (import bindings)) (##co......
<syntax> (##core#begin (##core#begin (##sys#require (quote bindings))) (import bindings))
<syntax> (##core#begin (##sys#require (quote bindings)))
<syntax> (##sys#require (quote bindings))
<syntax> (quote bindings)
<syntax> (##core#quote bindings)
<syntax> (import bindings)
<syntax> (import scheme (only macro-helpers define-syntax-rule replace* seq-length seq-ref seq-tail bind-exce......
<syntax> (import scheme (only chicken receive case-lambda define-values let-values make-parameter error signa......
<syntax> (##core#undefined)
<syntax> (##core#undefined)
<syntax> (##core#undefined)
<syntax> (##core#undefined)
<syntax> (pp (bind (a b c) (list 1 2 3) (list c b a)))
<syntax> (bind (a b c) (list 1 2 3) (list c b a)) <--
If you use 'load' instead of 'include', there is no error. Also if the first script (test-case.scm) does (use bindings) there is no error.
I tested this with Chicken 4.8.0.3 and bindings egg version 3.1. Another person reported that they could reproduce the error with Chicken 4.9 as well.
Changes and comments
[2014-09-18 17:21:15 UTC] retroj wrote:
I receive the same error if I try to use the bindings egg inside of a module. Here is a test case for that:
- bindings-egg-inside-of-module.scm
(module bindings-in-a-module-test-case
*
(import chicken scheme)
(use bindings
extras)
(pp (bind (a b c) (list 1 2 3) (list c b a)))
)
[2014-09-18 17:21:43 UTC] retroj set cc to retroj
[2014-09-20 18:28:25 UTC] juergen changed status from new to closed
[2014-09-20 18:28:25 UTC] juergen set resolution to fixed
[2014-09-20 18:28:25 UTC] juergen wrote:
Replying to retroj:
This is neither a bug of Chicken nor of the bindings egg.
Chicken needs the library bindings to do its work.
So the following will do in
test-case.scm: -------------- (require-library bindings) (import scheme chicken extras) (include "script-that-uses-bindings.scm")
and in
script-that-uses-bindings.scm: ------------------------------ (import bindings) (pp (bind (a b c) (list 1 2 3) (list c b a)))
as well as in
binding-egg-inside-of-module.scm: --------------------------------- (module bindings-in-a-module-test-case *
(import chicken scheme bindings extras) (pp (bind (a b c) (list 1 2 3) (list b c a))))
[2014-09-20 18:37:54 UTC] juergen wrote:
Replying to juergen: > Replying to retroj: > > This is neither a bug of Chicken nor of the bindings egg. > > Chicken needs the library bindings to do its work. > > So the following will do in > > test-case.scm: > -------------- > (require-library bindings) > (import scheme chicken extras) > (include "script-that-uses-bindings.scm") > > and in > > script-that-uses-bindings.scm: > ------------------------------ > (import bindings) > (pp (bind (a b c) (list 1 2 3) (list c b a))) > > as well as in > > binding-egg-inside-of-module.scm: > --------------------------------- > (module bindings-in-a-module-test-case * > (import chicken scheme bindings extras) > (pp (bind (a b c) (list 1 2 3) (list b c a)))) >
Of course, the first line in the last file should be
(require-library bindings)
I forgot that, sorry!
[2014-09-27 00:10:07 UTC] sjamaan changed status from closed to reopened
[2014-09-27 00:10:07 UTC] sjamaan removed resolution fixed
[2014-09-27 00:10:07 UTC] sjamaan wrote:
Hey Juergen,
I would like to look into this. I agree with John that it's a bit weird how this works. Possibly it's a bug in core, or simply a misunderstanding of how it's supposed to work on our side. Either way, I'd prefer to look into it to clarify the issue.
[2014-09-27 00:10:15 UTC] sjamaan changed status from reopened to assigned
[2014-09-27 00:10:15 UTC] sjamaan set owner to sjamaan
[2014-11-10 13:32:32 UTC] syn wrote:
There was a bug in the bindings module which made it impossible to use in compiled code: The binding syntax would sometimes expand to raw procedures rather than identifiers naming these procedures. This works in the interpreter but not in the compiler. Attaching a patch that fixes this issue at least for the case I found.
[2014-11-10 13:33:05 UTC] syn attached fix-bindings-for-compilation.diff (description=#f)
[2014-11-11 17:28:58 UTC] juergen changed status from assigned to closed
[2014-11-11 17:28:58 UTC] juergen set resolution to fixed
[2014-11-11 17:28:58 UTC] juergen wrote:
Version 3.3 is now available, which fixes the reported problem (albeit a bit differently than in the patch above). Moreover, in this version the helper module macro-helpers is extracted into its own library. That simplifies matters a bit. Juergen