tracker issue : CF-3429588

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

isCustomFunction() needs to do what it says on the box

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

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

Created: 12/14/2012

Components: Language

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final / 287995

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Windows 7 64-bit

Vote Count: 2

G'day:
isCustomFunction() has had its behaviour modified - and rendered illogical - in CF10 with the addition of closures.  See these docs:
http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d31851842acbba1353e848b35-7ff7.html

That is a stupid, illogical change. And is a bug.

A custom function is a custom function whether it is one created with a declaration or an expression. It is simply wrong to make this differentiation here.

See my observations here:
http://adamcameroncoldfusion.blogspot.com/2012/12/am-i-right-to-think-this-is-stupid.html

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

Watson Bug ID:	3429588

Deployment Phase:	Release Candidate

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

Attachments:

Comments:

I agree with the venn diagram on Adam's blog. I'm also not sure I see the purpose in a separate isCustomFunction() and isClosure() function. A function is a function to me regardless of how it was declared.
Vote by External U.
16936 | January 02, 2014 06:38:11 PM GMT
This will cause problems down the line, especially for framework authors. I'll add a longer note explaining why this is a stupid decision after submitting this vote.
Vote by External U.
16937 | January 02, 2014 09:39:44 PM GMT
Consider this: obj = new SomeThing; function f() { ... } obj.f1 = f; obj.f2 = function() { ... } Now obj has two dynamically added methods, f1 and f2, that can both be called and treated like regular methods. Suppose obj is being used inside a framework that does introspection on CFCs (pretty common with dependency injection / autowiring). That framework code will likely use isCustomFunction() to decide whether an element of THIS scope in the object is a function or just some data / state for that object. As of CF10, any functions dynamically added via function expressions are going to fail that test and the framework will think they are just data. Well, you might say, the framework could just use isCustomFunction(obj[x]) || isClosure(obj[x]) and indeed that would be required in order to work with function expressions... but then the framework will not run on ACF9 so you've pushed the framework author into an untenable position... And if you think this is not a real objection, take a look at the source code of the two most popular CFML frameworks: ColdBox and FW/1. Both of them currently use isCustomFunction() to test whether things are functions. DI/1 also relies on this.
Comment by External U.
16934 | January 02, 2014 09:46:49 PM GMT
Hey Adobe, what version of CF does build 287995 correlate to?
Comment by External U.
16935 | May 24, 2016 04:10:30 AM GMT