Issue #5574 has been updated by Ondrej Bilka.


I remember that in ruby-core long ago matz explained that array don't include comparable because they could contain elements that are not comparable.
I dont see this as problem as this is violated in most classes when comparing field that can be nil.
----------------------------------------
Feature #5574: Make arrays comparable
http://redmine.ruby-lang.org/issues/5574

Author: Arnau Sanchez
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Why are arrays not comparable? _Array_ already defines _<=>_, so it seems only natural to mix-in the _Comparable_ module.

<pre>
> [1, 2] < [1, 1] 
NoMethodError: undefined method `<' for [1, 2]:Array

> Array.send(:include, Comparable)
> [1, 2] < [1, 1] 
=> false
</pre>

This was already discussed in the mailing list a while ago and people agreed it would be useful:

http://www.ruby-forum.com/topic/76535


-- 
http://redmine.ruby-lang.org