> > > Is there a way to hook on invocation of *any* instance method of an
> > > object?
....
[snip]
....
>
> Code follows:
>
> module Observable
....
[snip]
....
> theproxy.another


that seems pretty complicated - it seems like what is needed is a
specialization of a class, espcially since only the assignment methods need
overridden.  isn't this *the* job of inheritence?  eg:


def assignment_hook(*args)
  re = /`([^']+)'/
  m = re.match caller(1)[0]
  m or raise 'FAILED TO LOOKUP METHOD NAME'
  methodname = m[1]

  # notify observer here...
  puts "hook for #{methodname}(#{args.join ','}) called..."
end

class Original
  def foo=(*args)
    # do something
  end
end

class Hooked < Original
  def foo=(*args)
    assignment_hook *args
    super *args
  end
end


h = Hooked.new
h.foo= 0,1,2	# --> hook for foo=(0,1,2) called...


simple : yes
fast   : yes
safe   : yes
typing : yes


-ara




-- 

 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================