Hi Jason,
Just an idea. Instead of always updating the "@modified"-flag why not
keeping the saved state of an instance (after loading and saving) in a
hashtable(@footprint) made up of <instvar name> => <instvar hash value>? 

module ObjectPersistence

  def modified?()
    return @footprint == createFootprint() 
  end

  def load()
    ...<do load object>
    @footprint = createFootprint()
  end

  def createFootprint()
    # "expensive" call ;-)
    footprint = Hash.new()
    instance_variables.each { | instVarName |
      footprint[instVarName] = instance_eval("@#{instVarName}.hash()")
    }
    return footprint
  end

  def save()
    if modified?() then
      ...<do save object>
      @footprint = createFootprint()
    end
  end	
end

Regards
Clemens

> 
> I'm working on a Ruby binding for the GOODS object-oriented 
> database.  What 
> I need is some mechanism for determining when an instance 
> variable for a 
> given object has been modified in some way.  Currently, my 
> binding relies 
> on naming conventions, such that methods ending with '!' or '=' are 
> considered "modifiers", and invoking them will mark the receiver as 
> modified.  I'd rather not rely on a naming convention to handle this, 
> though.
> 
> Is there a better way to do this?  I know that global 
> variables can be 
> traced for modification.  Is there some way to trace instance 
> variables as 
> well, either in standard Ruby or any existing library?  I'm 
> already using 
> AspectR for the binding, but I don't think it supports 
> tracing instance 
> variables.
> 
> Thanks,
> Jason Voegele
> 
>