[Larceny-users] [long] identifier bindings and visibility across phases

Marco Maggi marco.maggi-ipsu at poste.it
Tue Oct 6 17:02:44 EDT 2009


"Andre van Tonder" wrote:
> On Tue, 6 Oct 2009, Andre van Tonder wrote:
> 
> > WOPPA is not exported from library DEF, so any attempt to refer to it from
> > outside DEF should fail.  The behavior of Larceny and Ypsilon are correct,
> > and that of Ikarus and Mosh are incorrect.
> 
> Reconsidering, I think this might be underspecified in R6RS, so both
> behaviours might be fine.

Thanks, I see that changing (def) to:

(library (def)
  (export woppa)
  (import (rnrs) (lib))
  (define (woppa) 123)
  (define-thing woppa woppa))

makes everything work; are  there relevant paragraphs in the
R6RS  documents?   It  seems  to  me  that  the  chapter  on
SYNTAX-CASE  says  nothing  about non-exported  bindings  in
syntax objects.

  But, if it is an export problem, why the following works?
BLUE is not exported by (sublib):

(library (sublib)
  (export h)
  (import (rnrs))
  (define (blue)
    456)
  (define h
    (make-eq-hashtable))
  (hashtable-set! h 'b blue))

(library (lib)
  (export thing)
  (import (rnrs) (for (sublib) expand run))
  (define-syntax thing
    (lambda (stx)
      (syntax-case stx ()
	((_)
	 (with-syntax ((f (hashtable-ref h 'b #f)))
	   #'('f)))))))

;;; the program
(import (rnrs) (lib))
(write (thing))

is it  a specific  interaction between exporting  and syntax
objects?  The following works with Ikarus, Mosh and Ypsilon;
it fails only on Larceny:

(library (sublib)
  (export h)
  (import (rnrs))
  (define (blue)
    456)
  (define h
    (make-eq-hashtable))
  (hashtable-set! h 'b (syntax blue)))

(library (lib)
  (export thing)
  (import (rnrs) (for (sublib) expand run))
  (define-syntax thing
    (lambda (stx)
      (syntax-case stx ()
	((_)
	 (with-syntax ((f (hashtable-ref h 'b #f)))
	   #'(f)))))))

;;; the program
(import (rnrs) (lib))
(write (thing))

-- 
Marco Maggi



More information about the Larceny-users mailing list