This is the mail archive of the kawa@sourceware.cygnus.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: kawa question [forwarded]


"Paul R. Potts" <potts@umich.edu> writes:

> This works great, I now have a simple binding object (name/value pair):
>
>             myInterpreter . getEnvironment() . put ( b . getName (),
>                 b . getValue () );
>
> This seems to work fine, and I can now look at myInterpreter in the
> debugger, see its environ object, and the table in there, and it looks like
> vegHowHigh was set up properly.
>
> So now I try again:
>
>             Object r = myInterpreter . eval ( aScript );
>
> And I once again get an unbound symbol exception on "VegHowHigh."

I suspect you need to put(b.getName().intern(), b.getValue()).  Scheme
symbols need to be interned, which doesn't happen automatically in
Java with non-constant strings.

> My hope was I could just do the eval and then clear the VegHowHigh binding
> from the current environment like this:
[snip]
> and then if I have to reference this variable in the future, I will again
> look in the journalled file system of bindings and possibly find a later
> version.
[...]
>
> I know there is probably a better way to do this using closures or
> continuations or some such, but my knowledge of Lispy languages is somewhat
> minimal.

Your Scheme code will be hard to understand if you have the value of a
binding changing for unknown reasons.  I would suggest creating a
survey-answer procedure so that your Scheme code could do something
like this:

(let ((VegHowHigh (survey-answer 'VegHowHigh)))
  (manipulate VegHowHigh)
  ...)


--
Bruce R. Lewis                  <URL:http://web.mit.edu/brlewis/www/>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]