From: Lin Jen-Shin Date: 2008-08-08T06:17:41+09:00 Subject: [ruby-core:18177] Re: [Ruby 1.8 - Bug #252] Array#sort doesn't respect overridden <=> On Aug 5, 3:49�am, Charles Oliver Nutter wrote: > Nobuyoshi Nakada wrote: > > Hi, > > > At Thu, 10 Jul 2008 16:44:33 +0900, > > Vladimir Sizikov wrote in [ruby-core:17720]: > >> This seems to be a common performance trick in MRI, esp. for Fixnums and Strings. > > >> Looking at array.c (sort_2), indeed Fixnums and Strings are special-cased. > > > I've forgotten to post this patch. > > So this is going to be a behavioral change now? My reading of the patch > tells me it's now checking to see if <=> has been overridden and if so > using the path that actually calls it. As Ryan pointed out, this would > be new behavior. Can we get an official ruling on what is correct in 1.8 > and 1.9.x? > > - Charlie And should this behavior apply to condition (e.g. if, unless, while, etc.) to call :nil? as well?