[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: Alex Shinn
Subject: Re: Gurus? Care to re-explain the absense of gh_set_x() for me?
Date: 13 Jul 2001 13:14:32 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.103

>>>>> "Sam" == Sam Tregar <address@hidden> writes:

    Sam> On 13 Jul 2001, Alex Shinn wrote:
    >> If what was pointing to a?

    Sam> My SCM operand could be bound to a global define or be part
    Sam> of a list or a value in a hash or...

Not quite - a global define or list element would be bound to the SCM,
not the other way around.  If you want to modify a list/hash, you
would do so by modifying the cars/cdrs in the pairs of the list, by
binding them to fresh new SCM's.  These changes would be reflected in
other references to the same list.  If you want to modify a global you
have to do this with the equivalent of gh_set_x (sorry, I know Perl
internals better than Guile's so I can't help you here :) But this is
a naming operation - you're setting a globally named variable to a new
SCM, so if from the Perl side all you have is the SCM, you don't
really have the full concept of the "global variable".

Hmmm... not sure what the implications of directly changing the SCM
struct contents would be, and whether this might break things in

    >> In Perl, you probably just want to point to the same Perl
    >> value, which contains an SCM.  Mutating functions would then
    >> just bind this to a new SCM.

    Sam> Actually, it's problematic on the Perl side as well since I'm
    Sam> binding each unique SCM to a unique Perl object.  Don't worry
    Sam> about that side of things tho - Perl programmers are used to
    Sam> the problematic properties of assignment on references.

Right, you have one Perl object with an SCM, and references would be
references to the Perl object, not the SCM, so if the original Perl
object binds to a new SCM, the change will be reflected in the
references.  Or am I missing something?

    Sam> Fair enough.  In some ways this project is specifically about
    Sam> trying to do the wrong thing!  Who could call it right for
    Sam> Perl and Guile to work together?

I think it's pretty cool :) I just wish it were the other way around.
Perl's Inline is best for snarfing up the libs and utilities of other
languages, and while it would be great to have all of CPAN available
in Guile, Guile and Scheme in general are a little anemic on the
library side, and not much use to Perl.

Alex Shinn <address@hidden>

reply via email to

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