Open Object Rexx™ Reference, Version 4.1.0 Edition, December 2010
5.3.18.1. Sorting non-strings, pp. 281
a = .array~new
a[1] = .Employee~new(654321, "Fred")
a[2] = .Employee~new(123456, "George")
a[3] = .Employee~new(333333, "William")
a~sort
do employee over a
say employee -- sorted order is "George", "William", "Fred"
end
return
::class Employee inherit Comparable
::method init
expose id name
use arg id, name
::method id attribute
::method name attribute
::method compareTo
expose id
use arg other
return id~compareTo(other~id) -- comparison performed using employee id
::method string
expose name
/ use arg name / <--------------------------------remove this line to get correct results
return "Employee" name
Anonymous
Committed revision 7471. For docs/rexxref
Committed revision 7472. For docs/branches/4.1
Thanks for opening this up.
The fix for this item was in the 4.1.1 or 4.1.0 release.