tracker issue : CF-3749301

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

Built-in functions as "first class" glitch in function return values

| View in Tracker

Status/Resolution/Reason: To Fix//

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

Created: 04/24/2014

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: PublicBeta /

Priority/Frequency: Major / Some users will encounter

Locale/System: ALL / Platforms All

Vote Count: 4

See: http://cfmlblog.adamcameron.me/2014/04/coldfusion-11-quick-look-at-what-data.html

{code}
function function regurgitateFunction(required function f){
    return f;
}

writeOutput("<h3>Built-in function</h3>");
midref = mid;
safe(function(){
    resultWithBuiltInFunction = regurgitateFunction(midref);
    writeDump(var={object=resultWithBuiltInFunction, type=resultWithBuiltInFunction.getClass().getName()});
});


function safe(f){
    try {
        f();
    }catch(any e){
        writeOutput("#e.type#: #e.message#; #e.detail#<br>");
    }
}
{code}

Errors with:

function: The value returned from the regurgitateFunction function is not of type function.; If the component name is specified as a return type, it is possible that either a definition file for the component cannot be found or is not accessible.

This makes no sense as the function was accepted as an argument of return type "function" to the function, but then as not legit as a return type of "function"

-- 
Adam

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

Watson Bug ID:	3749301

Reason:	BugVerified

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

Attachments:

Comments:

If we're going to get into functional programming (and to be clear: allowing functions as arguments means we are),then ALL functions need to be fair game.
Vote by External U.
12558 | September 30, 2015 01:00:41 PM GMT
+1 ......................
Vote by External U.
12559 | September 30, 2015 04:07:40 PM GMT
Built-in functions and user-defined functions should behave consistently in all places where a function can be passed or is expected as an argument.
Vote by External U.
12560 | November 26, 2015 07:12:57 AM GMT
Can you please confirm in what version of ColdFusion this is going to be implemented in. It says "to fix" but does not say which version.
Comment by External U.
12557 | January 25, 2016 08:26:36 AM GMT
Hi Adobe, The "+1 ......................" is my vote, which I'm unable to edit for whatever reason. I'd like to elaborate: This needs fixed for *ALL* built-in functions. CF-4202219 needs re-opened/fixed. Thanks!, -Aaron
Comment by Aaron N.
30790 | May 21, 2019 04:09:24 AM GMT