"Rony G. Flatscher" <[email protected]> wrote:

> Yesterday I stumbled over a surprising behaviour of Array's sort, which
> led me to open a bug report <https://sourceforge.net/p/oorexx/bugs/1107/>.
> Obviously the sorting is working as designed, hence the reported behaviour
> was not accepted as a bug.

I've read this and the bug report and think one could argue it from both
points of view...

I've also looked at the Ref manual section on arrays.  I'm very much not an
expert on any of the oo stuff.  Arrays are descibed though as:

  "An array is a possibly sparse collection with indexes that are positive
whole numbers."

which says to me that sparseness (which might be the issue) are an expected
attribute of an array.


I looked at the definition of "remove".  It does not say that an array which
has had an item removed ceases to be an array, and it does not say that such
an array (if not already sparse) becomes sparse.  That would say to me,
naively(?) that a sortable array which then has an element removed, is still
a sortable array.


On the other hand the sort method says right at the start

  "Sorts an array of Comparable items"...

which makes me wonder if there might be an element of the "if a == .nil"
issue involved in this?

Also the link to "sorting arrays" takes one to text that says:

   "Any non-sparse Array instance can have its elements placed into sorted
order using the sort method of the Array class."

which without going into useful details does suggest sparseness is an issue.


Maybe it would be useful if arrays had an attribute that said whether or not
they were sparse? 


On the whole I think I'd go with Rony's view that removed items should all
sort together to one or other extreme of an array, if they're still part of
the array.  Otherwise, "remove" might as well be renamed "ruin".



-- 
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to