Summary
Chicken 4.5.0 has a strange issue with out-of-module imports
Metadata
- Id: 805087b540af4a6d9f38c842f581f21cbd5d02a2
- Trac id: 268
- Type: defect
- Reporter: sjamaan
- Owner: sjamaan
- Cc:
- Status: closed
- Component: extensions
- Estimated difficulty:
- Resolution: fixed
- Priority: critical
- Milestone:
- Version: 4.5.x
- Changetime: 2010-06-08 21:20:00 UTC
- Created: 2010-06-07 23:39:09 UTC
- Keywords: macros, s48-modules, modules
Description
Simply put, in chicken 4.4.0, chicken-install prometheus succeeds. In chicken 4.5.0 it doesn't:
Warning: reference to possibly unbound identifier: include-relative Error: module unresolved: _hermes
For some reason the (require-extension s48-modules) is not working correctly. Commenting out a couple of the earlier module declaration forms in prometheus.scm cause it to understand the include-relative.
It's a really weird issue and I'm still not sure what the exact cause is, but I decided to create a ticket so we can keep track of this. I will try to do some more investigation, but perhaps you already have an idea what could be the cause of this, Felix?
Changes and comments
[2010-06-08 08:14:47 UTC] felix changed status from new to accepted
[2010-06-08 08:15:21 UTC] felix changed keywords from macros, modules to macros, s48-modules, modules
[2010-06-08 08:15:21 UTC] felix changed version from 4.5.0 to 4.5.x
[2010-06-08 08:15:21 UTC] felix changed component from compiler to extensions
[2010-06-08 08:15:21 UTC] felix removed milestone 4.6.0
[2010-06-08 11:40:37 UTC] felix changed status from accepted to assigned
[2010-06-08 11:40:37 UTC] felix changed owner from felix to sjamaan
[2010-06-08 11:40:37 UTC] felix wrote:
Below is a patch for s48-modules that seems to help. That extension definitely was incorrect for not importing `include-relative`, since it is used for the `files` clause. Why it seems to work with modules removed I can't say right now. Since modules are syntax-stripped anyway, all the renaming doesn't make much of a difference.
I also fixed a problem for using `include-relative` outside of a loaded file. Please try the patch and tag a new version, if it works for you.
Index: s48-modules.scm
===================================================================
--- s48-modules.scm (revision 18383)
+++ s48-modules.scm (working copy)
@@ -26,7 +26,11 @@
(define-syntax include-relative
(lambda (x r c)
(let* ((old-file (s48-modules:get-current-file))
- (file (make-pathname (pathname-directory old-file) (cadr x))))
+ (file (make-pathname
+ (if old-file
+ (pathname-directory old-file)
+ ".")
+ (cadr x))))
`(,(r 'begin)
(,(r 's48-modules:set-current-file!) ,file)
(,(r 'include) ,file)
@@ -176,7 +180,7 @@
"invalid structure clause"
clause))))))
(let ((names (map (lambda (n) (##sys#strip-syntax (car n))) (cadr x))))
- (when (and (memq #:compiling ##sys#features)
+ (when (and (feature? #:compiling)
(any (lambda (n) (assq n ##compiler#import-libraries))
names))
(set! ##compiler#import-libraries
@@ -185,7 +189,9 @@
(string-append (symbol->string iname1) ".import.scm")
##compiler#import-libraries) ) ) )
`(,%begin
- (,%module ,iname1 * ,@(process-body (cddr x) #f))
+ (,%module ,iname1 *
+ (import (only s48-modules include-relative))
+ ,@(process-body (cddr x) #f))
,@(map process1 (cadr x))))))
)
[2010-06-08 17:08:39 UTC] sjamaan changed status from assigned to closed
[2010-06-08 17:08:39 UTC] sjamaan set resolution to fixed
[2010-06-08 17:08:39 UTC] sjamaan wrote:
Thanks Felix, this patch works great. How silly of me, I thought the bug was caused by the toplevel prometheus.scm wrapper file.
[2010-06-08 21:20:00 UTC] felix wrote:
Replying to sjamaan: > Thanks Felix, this patch works great. How silly of me, I thought the bug was caused by the toplevel prometheus.scm wrapper file.
Well, the error was somewhat obscure. BTW - it may be the case that `include-relative` also has to be imported for syntax, in case the `files` clause also occurs inside a `for-syntax` form. I'm not completely sure about this, though.