tracker issue : CF-3648785

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

Add closure support to blocking operations to alow them to be non-blocking operations.

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): Luis Majano / Luis Majano (Luis Majano)

Created: 10/10/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: 4

If we can compare to other languages in this age, we must provide some type of non-blocking IO operations natively into the language.  I propose adding closure callback support to the following functions/operations so they can be processed natively in the background (non-blocking) and then call back when done.

FileRead
FileWrite
cfquery
http
cffeed/feed
cfmail/mail
storedproc
ftp

etc


Basically any operation that can block a network or local resource.  Imagine doing this:

fileRead( file, function(contents){
  process file here in the background once it is read.
});

new http( url="xxx", method="post", results=function(content){ process here the results })

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

Watson Bug ID:	3648785

External Customer Info:
External Company:  
External Customer Name: LuisMajano
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

I have added more ideas and suggestions
Vote by External U.
14223 | October 11, 2013 03:23:27 AM GMT
Not only do I like the approach above, but it would be good for all ColdFusion to adopt. For example to take it a step further we could then do fileRead(file) { } Where the file is then read, and provides the handler, or whatever is required to do further processing. Or as Luis Suggested fileRead( file, function(contents){ process file here in the background once it is read. }); or fileRead( file, function);
Comment by External U.
14221 | October 11, 2013 03:26:45 AM GMT
To be considered for the next release
Comment by Rupesh K.
14222 | November 12, 2013 03:44:00 PM GMT
Agree, provided there's a broader look at how this sort of thing could generally be implemented.
Vote by External U.
14224 | September 01, 2014 03:36:27 AM GMT
+1 This, coupled with general futures/promises could open up a lot of use cases where we currently have to look to other languages for such functionality.
Vote by External U.
14225 | October 01, 2015 12:48:11 PM GMT
+1 ......................
Vote by External U.
14226 | October 03, 2015 08:09:27 PM GMT