This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: forcing a getter for variable accesses
- To: "Michael Livshin" <mike@olan.com>, "Greg Badros" <gjb@cs.washington.edu>
- Subject: Re: forcing a getter for variable accesses
- From: "Marisha Ray & Neil Jerram" <mpriz@dircon.co.uk>
- Date: Thu, 9 Sep 1999 08:29:01 +0100
- Cc: <guile@sourceware.cygnus.com>
From: Michael Livshin <mike@olan.com>
>Greg Badros <gjb@cs.washington.edu> writes:
>
>> Is there any way currently to force access to a variable via a getter
>> procedure? [...]
>
>don't export a variable at all, and instead export a function:
>
>(*desk-width*) - gets the value
>(*desk-width* new-value) - sets the value
Or alternatively,
(*desk-width*) - gets the value
(set! (*desk-width*) new-value) - sets the value
using the generic set! that was discussed on the list a while back. I think
that unnecessarily introducing another paradigm for getting/setting would be
confusing to users.
Neil