[plt-scheme] make-namespace in embedded scheme

From: support at taxupdate.com (support at taxupdate.com)
Date: Tue Feb 13 04:15:21 EST 2007

I'm having a little trouble understanding the use of scheme_make_namespace
in my program.  Here's a sample:

#include "scheme.h"

int main(int argc, char ** args)
{
   Scheme_Env * sc1 = scheme_basic_env();
   Scheme_Env * sc2 = (Scheme_Env *)scheme_make_namespace(0, NULL);

   scheme_eval_string("(define x 1)", sc1);
   scheme_eval_string("(define x 2)", sc2);

   Scheme_Object * p1 = scheme_eval_string("x", sc1);
   printf("p1 = %d\n", SCHEME_INT_VAL(p1));
   return 0;
}


I was expecting output of "1", but I get "2".  My expectation has been
that sc2 is a completely separate environment from sc1.  Any guidance?

Wayne


Posted on the users mailing list.