Hi all,

turns out the culprit was the use of -compile-syntax

    $ csc -c -compile-syntax test-compile-syntax.scm

    Warning: reference to possibly unbound identifier `barize'

    Error: module unresolved: foo


I'm still changing import clauses all over the place.  It's going to
take time until I will see how much harm removing the -compile-syntax
did.

Test attached.

/Jörg

Am Sun, 26 Mar 2017 21:04:25 +0200
schrieb Peter Bex <[email protected]>:

> On Sun, Mar 26, 2017 at 03:03:02PM +0200, Jörg F. Wittenberger wrote:
> >  (include "../mechanism/notation/Lalr/lalr-gen.scm");;[1]
> > 
> >  (define-syntax lalr-parser
> >    (er-macro-transformer
> >     (lambda (x r c)
> >       (apply gen-lalr-parser (cdr x)))))
> >   
> [...]
> > (module mystuff * 
> > (import lalrgen) (import-for-syntax lalrgen)
> > ...
> > 
> > Error: during expansion of (lalr-parser9196 ...) - unbound variable:
> > gen-lalr-parser
> > 
> > How should this work?  
> 
> Try
> 
> (begin-for-syntax (include "../mechanism/notation/Lalr/lalr-gen.scm"))
> (define-syntax lalr-parser ...)
> 
> > [1]: This lalr-gen.scm is a big cond-expand on the scheme
> > implementation defining among other things a syntax `logical-or` as
> > alias to logical-ior and uses these definitions in the procedure
> > gen-lalr-parser, which does the macro actual expansion.  The
> > implementation of the latter contains the reference to the renamed
> > logical-ior.  In other words: it's missing at expansion time.  
> 
> This was the crucial insight that was missing from your previous post.
> 
> Cheers,
> Peter

;; $ csc -c test-compile-syntax.scm
;; $ csc -c -compile-syntax test-compile-syntax.scm
;;
;; Warning: reference to possibly unbound identifier `barize'
;;
;; Error: module unresolved: foo

(module
 foo
 (bar)
 (import chicken scheme)
 (begin-for-syntax (define (barize . x) 42))
 (define-syntax bar
   (er-macro-transformer
    (lambda (x r c)
      (apply barize (cdr x)))))
 )
(module
 foobar
 *
 (import chicken scheme foo)
 ;(import hae?)
 (define barefoot (bar 23)))

(import foobar)
(use chicken.format)

(format #t "Seen ~a\n" barefoot)

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to