i am bringing a discussion over from the GUtopIa mailing list to get
some more general input on the problem of “automagical” bindings.
one of the main goals of gutopia is to be able to bind model data (i.e.
core-application data) to a gui interface such that changes to the data
are automatically reflected by specified changes in the gui.
we have thus far accomplished this, to a degree, by dynamically
modifying methods in the model to call on requested changes to the
interface. while adaquate and usable, in so far as it goes, i see
number of shortcomings that need to be addressed.
here’s the basic problem. if your are trying to bind to an array, for
example, in the model, how are you going to “trap” changes to that
array? a model may alter the array via #<< or #sort! or the like, and
such changes are indifferent to accessor_methods. indeed, you can alter
an array in this way via an attr_reader method!
so i was wondering if any of the ruby-talk crew had some ideas.
by the way, if you find this thread at all interesting we could still
use a number of additional minds involved with gutopia. join the mailing