tracker issue : CF-4198573

select a category, or use search below
(searches all categories and all time range)
Title:

sort member functions should accept compare and compareNoCase functions as comparator callbacks

| View in Tracker

Status/Resolution/Reason: To Test//Fixed

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron ()

Created: 04/30/2017

Components: Language, Functions

Versions: 2016

Failure Type: Others

Found In Build/Fixed In Build: ? /

Priority/Frequency: Normal /

Locale/System: / Platforms All

Vote Count: 2

See: http://blog.adamcameron.me/2017/04/cfml-lucee-13-v-4-14-v-6-coldfusion-we.html

This should work:

arrayToSort = ["d","C","b","A"];
arrayToSort.sort(compareNoCase);

It doesn't do anything (not even error).

This should also work:

listToSort = "d,C,b,A";
sortedList = listToSort.listSort(compareNoCase);

This one just errors:
You have specified invalid sorting inputs.
It could be a UDF functions or type.

That's not correct. A BIF should also work. More details & test cases in the blog article.

Attachments:

Comments:

+1 ...........
Vote by Aaron N.
833 | July 01, 2017 02:03:18 AM GMT
I think this should be generalized that any function that takes a callback should be able to accept a BIF, not just UDF.
Comment by Kama S.
30821 | May 24, 2019 06:46:59 AM GMT
Agreed.
Comment by Adam C.
30825 | May 24, 2019 08:55:40 AM GMT
Hi all, And -any- BIF, not just -certain- BIFs, right? Adobe closed https://tracker.adobe.com/#/view/CF-4202219 w/ "these functions due to internal compiler optimizations and transformations can't be made first class". Thanks!, -Aaron
Comment by Aaron N.
30827 | May 24, 2019 06:42:12 PM GMT