From: John Carter Date: 2006-12-01T07:24:40+09:00 Subject: Re: uneval,mtime,hash - Meta programming. On Fri, 1 Dec 2006, ara.t.howard@noaa.gov wrote: > harp:~ > ruby a.rb > [[:method_added], nil] > [[:adding_a_method], nil] > > now you just need to cache them before they are added. The trouble is the methods get "added" every time the script gets run. Thus depending "Makefile" like on the mtime isn't going to work. I need a way of doing a strong hash of the method "contents" to evaluate whether it has changed or not. The obvious would be an "uneval" or to intercept prior to eval and look at the string rep of the method. This has the downside of being inappropriately sensitive to white space and comments. A compile to byte code / interpret byte code system like yarv and jruby would have a byte code string that would be perfect. I think vanilla ruby has an internal 'tree of nodes' structure. I wonder how to grab that... John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand