tracker issue : CF-3614460

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

.. and ... range operators (and Range data type)

| View in Tracker

Status/Resolution/Reason: Closed/Deferred/NotEnoughTime

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

Created: 08/19/2013

Components: Language

Versions: 10.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 1

See http://cfmlblog.adamcameron.me/2013/08/thinking-about-operators-in-cfml.html

This is trickier as it creates a "range" (http://ruby-doc.org/core-2.0/Range.html) which is a concept CFML doesn't have. However the concept is an interesting one.
The range 1..10 is basically a sequence of values from 1-10. If one was to convert it to an array, one would have [1,2,3,4,5,6,7,8,9,10].

Ranges can be used for sequences, eg:

for (i in range){
     // do stuff
} 

//or
range.each(callback);

Or in conditional statements, eg:
if (examScore in 50..100){
    //pass
}else{
    //fail
}

and that sort of thing.

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

Watson Bug ID:	3614460

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

Attachments:

Comments:

To be considered for the next release
Comment by Rupesh K.
14697 | November 12, 2013 03:44:47 PM GMT
OK, can you reopen then pls? Cheers.
Comment by External U.
14698 | December 10, 2014 08:04:54 AM GMT
I would like to see this reopened as well. I think that creating a new data type (range) is a pretty major undertaking. Is there any reason it couldn't just be shorthand for generating an array spanning the given range values? All of your usage examples thus far seem like they would be array-compatible, Adam.
Comment by External U.
14699 | December 11, 2014 02:37:13 PM GMT
Whether as shorthand for array creation or as a new data type, I think this could be a valuable addition.
Vote by External U.
14700 | December 11, 2014 02:37:38 PM GMT