From: "Mauricio Fernández" Date: 2004-04-03T06:28:30+09:00 Subject: Re: Variable names On Sat, Apr 03, 2004 at 01:30:34AM +0900, Dave Thomas wrote: > > On Apr 2, 2004, at 10:20, David King Landrith wrote: > >Is there any way to access the name of a given variable instance from > >within it? In other words, for any object x, is there C function to > >which I can pass self to determine that the program calls it 'x'? > > You have the file name and line number, and you may even have the file > itself in SCRIPT_LINES, so you could cheat and find the name from that. > > I'm interested in tis experiment: how often does it catch a problem > that you didn't catch though unit testing? Putting that another way: > how often do you see these type errors in testing, and how often in > production? > This looks like a restricted version of Eivind Eklund's types.rb. Here's what the author had to say about it: "The reason I didn't do any particularly public release of it was that I found that adding type checks to ruby programs were worse than useless for me - it got in the way of my refactoring, without catching many bugs." See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/84841. -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com "You, sir, are nothing but a pathetically lame salesdroid! I fart in your general direction!" -- Randseed on #Linux