[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: |
Matthias Koeppe |
Subject: |
Re: Gurus? Care to re-explain the absense of gh_set_x() for me? |
Date: |
Fri, 13 Jul 2001 19:11:07 +0200 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.6 |
Sam Tregar <address@hidden> writes:
> On Fri, 13 Jul 2001, Matthias Koeppe wrote:
>
>> 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.
I don't think there is a high "cost in terms of transparency" here.
In fact, it would be very non-Schemey (thus non-transparent to Scheme
users) to have variables with an unusual (in this case, Perl-like)
semantics.
For instance, we have "thread-local variables" (fluids) which are
addressed in much the same way as I suggested for your situation:
using FLUID-REF and FLUID-SET!.
If you like, you could also introduce a SRFI-19-style
getter-with-setter like this:
(define perl-value (getter-with-setter box-ref box-set!))
Then you could do (PERL-VALUE BOX) to get the value and (SET!
(PERL-VALUE BOX) VALUE) to set it. This also enables the use of
mutating macros like INCREMENT! that work both with normal Scheme
variables and your Perl boxes:
(define-macro (increment! location)
`(set! ,location (+ ,location 1)))
Thus:
(perl-value x) => 7
(increment! (perl-value x))
(perl-value x) => 8
(Should I suggest to (DEFINE $ PERL-VALUE) now? Nah.)
You may also want to have a look at the Guile Emacs project
(http://gemacs.sourceforge.net/). They are posed with pretty much the
same problem as you are; they have to access Emacs Lisp variables from
Guile.
--
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, (continued)
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Miroslav Silovic, 2001/07/15
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Matthias Koeppe, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Sam Tregar, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Brett Viren, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Sam Tregar, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, tom, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Matthias Koeppe, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Sam Tregar, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?,
Matthias Koeppe <=
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Sam Tregar, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Klaus Schilling, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Alex Shinn, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, rm, 2001/07/14
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Alex Shinn, 2001/07/14
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Thomas Bushnell, BSG, 2001/07/13
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Thien-Thi Nguyen, 2001/07/14
- Re: Gurus? Care to re-explain the absense of gh_set_x() for me?, Martin Grabmueller, 2001/07/14
- Guile At Work (was Re: Gurus? Care to re-explain the absense of gh_set_x() for me?), Evan Prodromou, 2001/07/14
- Re: Guile At Work (was Re: Gurus? Care to re-explain the absense of gh_set_x() for me?), Thien-Thi Nguyen, 2001/07/14