This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: forcing a getter for variable accesses


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]