Hi,
> Do you have an example of a getter/setter function.
> I can't find a reference to such in the documentation that
> I have.
> :) Tim
Here is an example of a different kind using a function with
static local variables - see sfun.r at www.rebol.org
cell: func [
[catch]
{create a function that holds a value}
require-type [datatype!]
initval [any-type!]
/local err
] [
if error? set/any 'err try [do func [x [require-type]] []
get/any 'initval] [throw err]
sfun [value: none set/any 'value get/any 'initval origset:
:set] [
/set newval [require-type]
] [
either set [origset/any 'value get/any 'newval] [
get/any 'value
]
]
]
a: cell integer! 5
print a
a/set 18
print a