[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gurus? Care to re-explain the absense of gh_set_x() for me?

From: Rob Browning
Subject: Re: Gurus? Care to re-explain the absense of gh_set_x() for me?
Date: 13 Jul 2001 13:11:14 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Sam Tregar <address@hidden> writes:

> This is roughly what I was expecting the non-existent gh_set_x() to
> do - change the value stored in an SCM without otherwise disturbing
> its identity.

I'm not sure I fully understand what you're trying to do, but it
sounds like Guile *might* be able to support what you want.

If I understand correctly, the key is that you want something that
represents the actual "location" of the scheme variable, so that if
you modify it, the change shows up both on the guile side and the perl
side.  I believe that guile *might* be able to handle that if you
switch to using some functions from the scm interface, but Marius or
someone more familiar with the code, and with what's considered kosher
will have to let you know if this is really "OK".

As I understand it (by osmosis really -- I don't know of relevant
docs), guile represents variables internally as something like (if not
actually) a scheme pair or cell.  When you call gh_lookup, or
gh_eval_str, what you get is just the thing stored in that cell, not
the cell itself.  However, if you call scm_lookup, you'll get the cell
(or variable) itself.  Then you can use scm_variable_ref and friends
(including scm_variable_set_x) to modify the value stored in the

However, I'm not sure if this variable is maintained across redefines.
I.e. I suspect that if you had (mixing scm and perl side actions):

  (define foo 4)
  $foo = 5;
  (set! foo 9)
  print "$foo\n";

you'd get 9 printed as expected, but if you had:

  (define foo 4)
  $foo = 5;
  (define foo 9)
  print "$foo\n";

I'm not sure what you'd get.

And again, before taking my suggestion as a possible solution, I'd
check with others and make sure my educated guesses about what's going
on are even remotely right, and are planned to be supported in the

Hope this helps.

Rob Browning
rlb,, and
GPG=1C58 8B2C FB5E 3F64 EA5C  64AE 78FE E5FE F0CB A0AD

reply via email to

[Prev in Thread] Current Thread [Next in Thread]