[Scheme-reports] loading libraries Michael Montague (23 Oct 2013 18:34 UTC)
Re: [Scheme-reports] loading libraries John Cowan (23 Oct 2013 22:28 UTC)
Re: [Scheme-reports] loading libraries Alex Shinn (24 Oct 2013 01:13 UTC)
Re: [Scheme-reports] loading libraries Michael Montague (24 Oct 2013 04:33 UTC)
(missing)
Re: [Scheme-reports] loading libraries Michael Montague (24 Oct 2013 16:17 UTC)
Re: [Scheme-reports] loading libraries Alex Shinn (25 Oct 2013 00:44 UTC)

Re: [Scheme-reports] loading libraries Michael Montague 24 Oct 2013 04:33 UTC

On 10/23/2013 6:12 PM, Alex Shinn wrote:
> The libraries may in fact be loaded multiple times,
> to allow for models such as Racket which require
> clean environments for each library expansion in
> order to avoid unwanted macro interactions.
>

I don't understand how parameters work in implementations where
libraries can be loaded more than once.

In the following example, each time (bakery size) is loaded, size will
be bound to a different parameter. An implementation that loads
libraries each time they are imported would write (small cake). And an
implementation which loads libraries only once would write (large cake).

(define-library (bakery size)
     (import (scheme base))
     (export size)
     (begin
         (define size (make-parameter 'small))))

(define-library (bakery cake)
     (import (scheme base))
     (import (bakery size))
     (export make-cake)
     (begin
         (define (make-cake)
             (list (size) 'cake))))

;; program
(import (scheme base))
(import (scheme write))
(import (bakery size))
(import (bakery cake))

(parameterize ((size 'large)) (write (make-cake)))

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports