On Sat, 26 Nov 2005, Daniel Schierbeck wrote: > I just think it's weird that PHP has destructors and Ruby doesn't ;) > > http://www.php.net/manual/en/language.oop5.decon.php I find this tricky too: the only model I can think of is that where you need destructors, your constructor desstructs, and you get at the object with a block, in the style of open("file"){|f| ...}; if you see what I mean. > > I'm not really into C, neither am I familiar with the Ruby implementation, but > doesn't all variables just reference an object? So somewhere, an object is > stored, and each variable referencing it really only holds that object's id. I > imagine the `finalize' method could be run, and afterwards, the object could > be replaced with nil, maybe retaining the old object id. That way any > variables that point to the object will be nil. But there is only one nil in the system, so it can't have many ids. > > Now, I don't know if that's how it works, but it sounds logical to me, > speaking as a guy who's never taken any programming lessons or > programmed/scripted using other languages than PHP, JavaScript and Ruby... > > > Cheers, > Daniel > Hugh >