From: KONTRA Gergely Date: 2003-08-07T23:22:39+09:00 Subject: Re: C's static equivalent Woof. Thx. It works, but it's a bit too obscure hacking for a damned easy counter, isn't it? On 0807, ts wrote: > >> Use a closure > K> Could you be more verbose? Eg. how to print out how many times a > in ruby, yes. in english, no :-) > K> function was called. > svg% cat b.rb > #!/usr/bin/ruby > def test1 > a = 10 > proc { a += 1; puts a } > end > > class Object > define_method(:tt, test1) > end > > tt > tt > > uu = test1 > uu[] > uu[] > svg% > > svg% b.rb > 11 > 12 > 11 > 12 > svg% > Guy Decoux -- +-[ Kontra, Gergely PhD student Room IB113 ]---------+ | http://www.mcl.hu/~kgergely "Olyan langesz vagyok, hogy | | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" | +-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+