[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: Sam Tregar
Subject: Re: Gurus? Care to re-explain the absense of gh_set_x() for me?
Date: Fri, 13 Jul 2001 12:18:17 -0400 (EDT)

On Fri, 13 Jul 2001, Matthias Koeppe wrote:

> Have I understood you correctly: You have Perl variables, $foo and
> $bar say, each of which hold one SCM object.  For instance, $foo holds
> an SCM representing the integer 1, and $bar holds an SCM representing
> 2.  Now you do $foo += $bar, and you expect $foo to hold a SCM
> representing the integer 3?

Exactly.  And whatever might have been pointing to the SCM for $foo should
see the new value.  That won't happen if I:

  $foo = scm_add($foo, $bar);

> You need to pass the *location* of FOO in some way.  I seem to have
> understood that FOO and BAR aren't actually Scheme variables (whether
> local or global) but "boxes" with SCM content that reside on the Perl
> side; so my original macro suggestion doesn't help.

Right.  You can think of them as an "SCM *" with a bit of extra magic
thrown in.

> You should simply reify your boxes on the Scheme side and provide
> functions like (BOX-REF BOX) and (BOX-SET! BOX VALUE) in order to
> access them.

Interesting proposal.  It would solve the problem but at a pretty high
cost in terms of transparency of use.  Ultimately I'd like to have a
system that makes using Perl and Guile together almost seamless.

At least for now I'll probably just put a big warning in my docs about
mutating operaters (+= -= /= *= ++ --) and how they won't maintain links
in the Guile variable space.


reply via email to

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