The sort command for lists most definitely needs to be augmented with an
optional comparison function argument. For example, if I had a list of child
objects instantiated from a parent script that had a property named
"miValue", and I wanted to sort the child object list based on the value
held in that property, a comparison function would allow me to do that
cleanly and quickly.
sort list, #compareHandler {, targetObject}
I could use it like this:
sort mlThings, #mThingCompare, me
Then my comparison function could be something like:
on mThingCompare poThing1, poThing2
return (poThing1.miValue - poThing2.miValue)
end
Just like qsort in Standard C, the comparison function would return:
negative value = element 1 is less than element 2
0 = element 1 and 2 are equal
positive value = element 1 is greater than element 2
And the list would be sorted according to that criteria. The only real
problem I see to this is that a sorted list remains sorted, even when adding
new items to it. So, after sorting, the comparison function would need to be
accessible any time the list was altered.
Is there a specific email address I should be sending suggestions like these
to?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Christopher Watson
Sr. Software Engineer
Lightspan, Inc.
http://www.lightspan.com/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]