tracker issue : CF-3950736

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

IIFEs

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

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

Created: 03/10/2015

Components: Language

Versions: 11.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF11_Final / latest build

Priority/Frequency: Trivial / Unknown

Locale/System: English / Platforms All

Vote Count: 10

http://en.wikipedia.org/wiki/Immediately-invoked_function_expression

This should work in CFML:

{code}
(function(){
	writeOutput("hi");
})();
{code}

Where "work" means it outputs hi. This is a very contrived example, but being able to memory space blocks of code is quite handy in other languages, and that CFML has function expressions but NOT IIFEs seems a bit half-implemented.

Also: apologies if this is a duplicate. I am "certain" I've raised this previously, but cannot find it.

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

Watson Bug ID:	3950736

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

Attachments:

Comments:

See equiv Lucee ticket: https://bitbucket.org/lucee/lucee/issue/221/
Comment by External U.
8117 | March 10, 2015 07:43:31 AM GMT
+1 - I also voted for CF-3346435
Vote by External U.
8122 | May 14, 2015 06:01:27 PM GMT
Ah yes, Aaron found the original: CF-3346435 This can be closed in favour of that one, provided you re-triage CF-3346435 for CF12.
Comment by External U.
8118 | May 15, 2015 03:39:43 AM GMT
Another one from javascript that I think is a good idea, though in JS, it has been misunderstood and a little complicated to explain why you want it. Even still, we should do this.
Vote by External U.
8123 | June 29, 2015 08:50:53 AM GMT
There was a war. A Time War. The Last Great Time War. My people fought a race called the Daleks, for the sake of all creation. And they lost. We lost. Everyone lost. They're all gone now. My family. My friends. Even that sky.
Vote by External U.
8124 | June 30, 2015 12:09:36 PM GMT
This would make code easier to understand, and less dumb, as i can define and execute inline, without the a(){} a(); syntax crap.
Vote by External U.
8125 | July 02, 2015 12:53:46 PM GMT
Any updates on this "review" that it needs?
Comment by External U.
8119 | January 25, 2016 08:30:51 AM GMT
> Any updates on this "review" that it needs? Hello?
Comment by Adam C.
8120 | August 02, 2017 07:14:03 AM GMT
:/
Comment by Aaron N.
8121 | August 04, 2017 08:58:48 AM GMT
Relates to: https://tracker.adobe.com/#/view/CF-3041263 and https://tracker.adobe.com/#/view/CF-3346435
Comment by Bradley W.
29280 | July 11, 2018 05:26:27 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 W.
29829 | October 23, 2018 09:36:57 PM GMT