1. You have a nontrivial problem to answer in the form of, "what happens if
you place more than one {getter,setter} on a variable?"
[I, of course, have some ideas. Ousterhout (Tcl) has others... see
ftp://ginsberg.cs.berkeley.edu/pub/asah/papers/dmt-tcl95.*
If you like DMT semantics, I'd be thrilled to implement them for Guile,
now that I've finished the Tcl implementation]
2. You need to worry about finalization, because many of the really useful
getters and setters require finalization support (ie. persistent
programming). This may fall out from guile's gc api... I haven't looked.
3. They bring up interesting semantic issues. Restating Per Bothner,
"what does a trapped variable denote?". My favorite example is the
question of getter-setter pairs on _slots_ in collections (vectors and
cons-pair slots). The similarity to promises is uncanny, but I haven't
thought about it.
4. getter-setters just _beg_ for high-level support. In Tcl, this meant
having "tags" for them and ways of manipulating and inspecting the resend
order. Yeah, I know that's incompatible with Scheme's simplicity thing,
but it would make a great extension... Again, I'll offer to write it.
5. There are interesting compilation issues. For starters, is there any easy
way to prove that a give variable can't be trapped? In general, it's hard.
Unfortunately, no hard enough for a PhD: it's a special case of the
overloaded-OOP-method (or slot in pure OOP) problem, which the Self folks
attacked vigorously.
There is some fun wins: if you arrange your resend semantics (multiple
traps on a single var) properly, then you can get some cool optimization
wins from a runtime codegen compiler. There's a really poorly-written
paper that Jon Blow and I wrote on this, also in pub/asah/papers...
6. Interlanguage callouts (ie. C) get harder: you have to ensure that users
ask (trapped?) before accessing variables. Once cute solution is what Tcl
does: if "most" of your callouts are deep copies, then you're forced to
call the getters as part of the callout. If you abstract the C API to
variable assignment, then you can hide getter-setters from C programmers.
In all of this, Rush sort of cheats, so its results may not be as relevant;
essentially, Rush removes cons-pairs from the language, thereby allowing
them to be special. Since pair? is a cheap operation, performing the
check is easy. By design, Rush supports passing conventions designed to
make read-only use of parameters cheap-- you won't need to check for
trapped? every time you access a variable. One useful note: the trapped?
checks are expensive, and using traps to implement pass-by-reference is
prohibitive. [I guess the latter is obvious]
Hope this helps,
adam