[plt-scheme] Modules, structs and environments

From: Joel J. Adamson (jadamson at partners.org)
Date: Mon Nov 19 12:57:33 EST 2007

"Jacob Matthews" <jacobm at cs.uchicago.edu> writes:

> I agree with Chongkai and with Noel. 

I would agree with him too if I knew what he meant ;)  I'm inclined to
go for "more hassle, more control" since part of the point is to learn
how to do this stuff.

> As an example of what Noel is saying, you can use a customized
> namespace to solve your particular problem like this:


>   (define ns (make-namespace))             ; make a namespace with the
> basic set of bindings
>   (parameterize ([current-namespace ns])   ; make eval look up names in ns
>     (namespace-require "struct.ss")        ; put the names from
> "struct.ss" into ns
>     (read-eval-print-loop)))

That's exactly what I want to do.  I tried somthing similar and still
got the error:
(define the-environment (current-namespace))
(parameterize ((current-namespace the-environment))

Now I see where the mistake was --- I didn't know about (make-namespace).
Thanks for pointing out the nuance.
Joel J. Adamson
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA  02114
(617) 643-1432
(303) 880-3109

The information transmitted in this electronic communication is intended only
for the person or entity to whom it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
information in error, please contact the Compliance HelpLine at 800-856-1983 and
properly dispose of this information.

Posted on the users mailing list.