tracker issue : CF-3041263

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

Bug 82579:(Watson Migration Closure)Function call should be allowed on any expression that yields a function:

| View in Tracker

Status/Resolution/Reason: To Test//Fixed

Reporter/Name(from Bugbase): Sean Corfield / Sean Corfield (Sean Corfield)

Created: 04/01/2010

Components: Language

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 9,0,0,251028 /

Priority/Frequency: Minor / Unknown

Locale/System: English / Mac 10 All

Vote Count: 16

Problem:

Function call should be allowed on any expression that yields a function:
s[key]( args ); // should be legal
arr[ n ]( args ); // should be legal for array of functions
func()( args ); // should be legal for func() returning a function

In particular:object[ method ]( args ); // should be legal and equivalent to:evaluate( "object.#method#( args )");

This is the script equivalent of:<cfcomponent component="#object#" method="#method#" argumentCollection=... />

Without this there's no way to do dynamic method invocation in <cfscript> without evaluate() - ugh!
Method:

\\blrfs04.macromedia.com\builds\coldfusion\bugs\82579


Result:

Invalid construct.A script statement must end with ";".The CFML compiler was processing:A script statement beginning with s on line 5, column 1.A script statement beginning with function on line 2, column 1.A cfscript tag beginning on line 1, column 2. The error occurred in /Applications/ColdFusion9/wwwroot/cf9/syntax.cfm: line 53 : s = { fn = greet };4 : s.fn(); // works5 : s['fn'](); // illegal

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

Watson Bug ID:	3041263

External Customer Info:
External Company:  
External Customer Name: Sean Corfield
External Customer Email: 479B4EDC43F3A88B992016B6
External Test Config: 04/01/2010

Attachments:

Comments:

+1 - this should definitely work
Vote by Aaron Neff
27837 | May 17, 2018 05:05:21 AM GMT
My gosh, this was put in for CF9. This works on Lucee and is a big deficiency in the CFML language of Adobe CF. Any expression that yields a function should be callable. This is just basic stuff that pretty much every scripting language supports. Why is this not fixed yet?
Comment by Bradley Wood
29283 | July 11, 2018 05:23:58 AM GMT
Relates to: https://tracker.adobe.com/#/view/CF-3950736 and https://tracker.adobe.com/#/view/CF-3346435
Comment by Bradley Wood
29284 | July 11, 2018 05:25:31 AM GMT
Just a Note, Lucee 5 now supports this as you can see here: https://trycf.com/gist/3693d9d5f99abdfcc62d182a2a441c7c/lucee5?theme=monokai
Comment by Bradley Wood
29828 | October 23, 2018 09:37:28 PM GMT