From: Brian Candler Date: 2003-07-01T21:42:39+09:00 Subject: Re: inifinity recursion && test/unit On Tue, Jul 01, 2003 at 08:38:42PM +0900, Andrey Kulinich wrote: > Originally that was an error. Code: > - > module Recur > def self.new > Recur.new > end > > class Recur > end > end > > Recur.new OK, so you have defined: - a module Recur - a class Recur::Recur - a module function Recur::new which calls Recur::Recur.new (it looks in its own namespace before trying enclosing namespaces, so Recur::Recur.new is used if it exists; if it doesn't then it will find Recur.new in the top-level namespace) So this is not recursive. > But after that I rename class Recur to Another and forgot to change in > def self.new. > Without test/unit ruby said that there is an infinite recursion. Is that > a bug or a feature? Neither, it's correct behaviour. If class Recur no longer exists, then the call to 'Recur.new' will refer to the function 'new' in module Recur, which is itself (hence infinitely recursive). Regards, Brian.