chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] inline-syntax and require-extension-for-sy


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] inline-syntax and require-extension-for-syntax
Date: Mon, 13 May 2013 20:17:26 +0200
User-agent: Mutt/1.4.2.3i

On Sun, May 12, 2013 at 10:49:09PM +0200, Felix wrote:
> Attached are some patches for adding two small enhancements:
> 
> 1) "require-extension-for-syntax"/"use-for-syntax", which does
>    the same as the often occurring idiom
> 
>      (begin-for-syntax (require-library FOO))
>      (import-for-syntax FOO)
> 
>    So this loads an extension and imports it, but at expansion time.

I had a chance to look at it just now.  There's a small problem with the
generated import libraries:

$ cat foo.scm
(module foo (foo)

  (import chicken scheme)

  (use-for-syntax srfi-1)

  (define-syntax foo
    (er-macro-transformer
      (lambda (e r c) `(,(r 'list) ,@(iota 5))))))
$ csc -s foo.scm -j foo
$ csi
#;1> (use foo)
; loading ./foo.import.scm ...
; loading /home/sjamaan/chicken-test/lib/chicken/7/chicken.import.so ...
; loading /home/sjamaan/chicken-test/lib/chicken/7/srfi-1.import.so ...
; loading ./foo.so ...

Note: the following toplevel variables are referenced but unbound:

  iota
#;2>


The attached patch fixes this by expanding to require-for-syntax instead
of loading the module at compilation time and expanding only to import.

Cheers,
Peter
-- 
http://www.more-magic.net

Attachment: 0001-Add-require-extension-for-syntax.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]