Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot define local syntax in libraries #703

Open
jpellegrini opened this issue Dec 19, 2024 · 1 comment
Open

Cannot define local syntax in libraries #703

jpellegrini opened this issue Dec 19, 2024 · 1 comment

Comments

@jpellegrini
Copy link
Contributor

jpellegrini commented Dec 19, 2024

Hi @egallesio !

This works:

(define-library (aa bb)
  (import stklos)
  (export yy)
  (begin
    (define xx 10)
    (define (yy) (print xx))))

(import (aa bb)
(yy)
10      ;; <== correct!

because xx is correctly defined as a local symbol in library (aa bb).

But this won't work:

(define-library (a b)
  (import stklos)
  (export y)
  (begin
    (define-syntax x
      (syntax-rules ()
        ((_) -1)))
    (define-syntax y
      (syntax-rules ()
        ((y) (print (x)))))))

(import (a b))
(y)
**** Error:
%execute: symbol 'x' unbound in module 'stklos'

because x seems to not be available when the macro y is used from outside library (a b)...

This forces us to export all macros that a library will use...

@egallesio
Copy link
Owner

Hi @jpellegrini,

This forces us to export all macros that a library will use...

This is exact for now, and it is on my TODO list (for now, I have no clear idea of how to implement it correctly 😥)
Thanks for adding this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants