tracker issue : CF-3041399

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

Bug 82787:(Watson Migration Closure)Default cannot be used as an argument name in cfscript

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/LowImpact

Reporter/Name(from Bugbase): Elliott Sprehn / Elliott Sprehn (Elliott Sprehn)

Created: 04/30/2010

Components: Language, CFSCRIPT

Versions: 9.0

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Normal / Most users will encounter

Locale/System: English / Platforms All

Vote Count: 4

Problem:

Default cannot be used as an argument name in cfscript. Since we can now use default for a function name, we should be able to use it as an argument name too.Understandably usage of the argument requires arguments.default to prevent ambiguation with the default clause of a case statement.
 Method:

[vmannebo 5/3/10]

 
{code}
<cfscript>
public string function default(required string default)
{ return default; }
writeoutput(default("hello"));
</cfscript>
{code}

 Result:

Invalid CFML construct found on line 138 at column 33.ColdFusion was looking at the following text:defaultThe CFML compiler was processing:A script statement beginning with public on line 138, column 9.A cfscript tag beginning on line 1, column 2. The error occurred in /Library/WebServer/Documents/testing9/testsuite/function_declarations.cfm: line 138136 : 137 : // Special function names138 : public function default(default) \{}

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

Watson Bug ID: 3041399

External Customer Info:
 External Company: 
 External Customer Name: Elliott Sprehn
 External Customer Email: 202D59C844579997992016B7
 External Test Config: 04/30/2010

Attachments:

Comments:

Agreed. This needs to be fixed.
Vote by Carl V.
22181 | January 13, 2017 05:54:22 PM GMT
The parser should be able to distinguish between the usage in a function signature and a switch statement. Plus if it works in tags, it should work in script.
Vote by Adam C.
22182 | March 27, 2017 07:46:53 AM GMT
When I try to vote, it says "Already voted". So, I already voted years ago. Thanks!, -Aaron
Comment by Aaron N.
22178 | March 30, 2017 04:20:59 AM GMT
Deferred until when? It's been 7yrs. Thanks!, -Aaron
Comment by Aaron N.
22179 | March 30, 2017 04:48:06 AM GMT
Possibly relevant: <cfscript> function f(numeric default=1) {writeDump(serializeJSON(ARGUMENTS));} f();//returns {"NUMERIC":1} on CF2016 and {"default":1} on Lucee </cfscript> Thanks!, -Aaron
Comment by Aaron N.
22180 | March 30, 2017 06:12:14 AM GMT