tracker issue : CF-3853251

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

Array methods: shift(), unshift(), push(), pop()

| View in Tracker

Status/Resolution/Reason: To Test//Fixed

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

Created: 11/18/2014

Components: Language

Versions: 11.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 8


Performing queue / stack operations on arrays is fairly common, and whilst doable with delete() / insert() methods, is not as elegant as these specific methods.
splice() is less obvious, and I'm not sure JavaScript (which is where I'm getting the motivation for these) gets it quite right. I see two operations here: basically an "interior" version of push() and pop(), where the items are inserted at the location (moving subsequent items down, not overwriting them), or extracting and returning from the specified location.

Oh: one nice syntactical trick PHP has is that one can push onto an array thus:
someArray[] = "value to put at end of array"
Note the empty square brackets indicate "at the end

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3853251

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:



Can we evaluate?
Comment by Vamseekrishna N.
10043 | December 11, 2014 06:27:07 AM GMT
These would make good additions
Vote by External U.
10048 | September 30, 2015 05:58:29 PM GMT
Good ideas! I particularly like the array[] = "something" shorthand idea, which is similar to an ER I raised about supporting &, &=, +, += operations with structs & arrays. ER: #CF-4058829.
Comment by External U.
10044 | September 30, 2015 05:58:50 PM GMT
I see this is marked "to fix". Can we get some detail of what subset of what I suggested is likely to get done, or is it "all of it"?
Comment by External U.
10045 | October 01, 2015 12:12:21 AM GMT
Vote by External U.
10049 | October 02, 2015 08:05:22 AM GMT
Agreed. These would be useful additions.
Vote by External U.
10050 | October 02, 2015 10:36:59 AM GMT
+1 ......................
Vote by External U.
10051 | October 03, 2015 08:22:49 PM GMT
+1 Immensely useful functions to have!
Vote by External U.
10052 | October 08, 2015 01:04:33 PM GMT
Being able to use arrays as queues / lists more easily is definitely a good thing. Splice sounds good too.
Vote by External U.
10053 | October 08, 2015 01:09:35 PM GMT
I'd certainly like to know specifics of what is actually being implemented so we can provide feedback.
Comment by External U.
10046 | October 08, 2015 01:12:58 PM GMT
Makes the language much more familiar (and less verbose) by incorporating standard function syntax from other languages.
Vote by External U.
10054 | October 08, 2015 01:25:44 PM GMT
Vote by External U.
10055 | October 14, 2015 11:03:14 PM GMT
Comment by External U.
10047 | January 25, 2016 08:22:25 AM GMT
ArraySplice has been implemented in ColdFusion 2018 Update 5. We have tracked ArraySplice as part of this bugĀ [|] I am removing splice() request from bug heading.
Comment by Mukesh K.
31361 | September 24, 2019 11:39:32 AM GMT