From: daz Date: 2004-05-13T13:08:52+09:00 Subject: Re: Proposal: Object#send(nil) -> self Gavin Sinclair wrote: > > Original poster was me, and I accept that #self(nil) is unpopular, and > I agree there's something wrong with it. And yes, #send(:self) would > help me, and appeals to me aesthetically as well. But I doubt the > name is acceptable. So what about (courtesy of Sascha) > > class Object > def yourself > self > end > end > > ... > > xyz.send(:yourself) > > # and of course > > xyz.yourself > > I don't care much for the name, but it's a Smalltalk thing, and > unless Smalltalk people think it sux, then it probably grows on you. > At least it is unlikely to conflict with a user's class; who has ever > created a method called 'yourself'? > > So, OP is satisfied, and we can probably wrap this thread up now :) > > Cheers, > Gavin > 'yourself' sux from reflexivity (I know what I mean :) but I think your solution is cute. I shall use it in this form: class Object def ego self end end p "The answer is: %d".ego % 42.send(:ego) -- daz C:\WINDOWS>echo 127.0.0.1 Just.Another.Ruby.Hacker>>hosts http://Just.Another.Ruby.Hacker:2004/