chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Exporting proc and macro that references it?


From: Alejandro Forero Cuervo
Subject: [Chicken-users] Exporting proc and macro that references it?
Date: Mon, 5 Jul 2010 13:04:02 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

I have a module embedded-test that exports a procedure called
'register' and a macro called 'test' that transforms a form into a
call to 'register'.  It looks like this (I'm simplifying a lot):

  (module embedded-test (test register)
  (import chicken scheme)

  (define (register) #f)
  (define-syntax test (syntax-rules () ((test) (register))))
  )

I install the extension and can use it from csi without problems but
when I try the following compiled program,

  (use embedded-test)
  (test)

I get:

  Error: unbound variable: embedded-test#register

  Call history:
          embedded-test#register                     <--

Am I doing something wrong?  I've tried various combinations of 'use',
'import', 'require-library', 'import-for-syntax' and
'require-extension' to no avail.  How does one make a macro transform
a form into a call to a procedure from its own module (that the module
exports)?

In case the answer is of the form "Chicken does not support this, what
are you trying to do?", what I'm trying to do is let the programmer
say things like (test (+ 2 3) 5) and have that transformed into
something like (register-test '(+ 2 3) (lambda () (+ 2 3)) (lambda ()
5) equal?).  If there are better ways to do this, I'm all ears.

For my format-compiler, I workarounded the let-optionals bug by
renaming 'rest' to 'rest-xrenamed' throughout my code but now I'm
stuck with this problem.  Any help would be appreciated.

Thanks!

Alejo.
http://azul.freaks-unidos.net/



reply via email to

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