tracker issue : CF-4198442

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

Cannot have argument named "default" in script function

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Bradley Wood / Bradley Wood ()

Created: 03/25/2017

Components: Language

Versions: 2016,11.0,10.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: 2016 / 2018.0.0.309145

Priority/Frequency: Normal /

Locale/System: / Platforms All

Vote Count: 6

Problem Description:
 Cannot have argument named "default" in script function. This worked in tags, and is also supported by Lucee Server so it is certainly doable. I get that "default" is a keyword, but when there is only one word between the commas, that should be assumed to be the argument name regardless of what it is.

Steps to Reproduce:
function test( required key, required value, default ){
Actual Result: Syntax error

Expected Result:

Code should work like it did in tags and like it does in Lucee Server.

Any Workarounds:

Use tags, or change the name of the argument (which may break backwards compatibility for a public API)



"This worked in tags" should be grounds enough to ensure this also works in script. And that Lucee can do it demonstrates it's not a problem.
Vote by Adam C.
1020 | March 25, 2017 09:11:00 AM GMT
+1 a related issue has been raised before in 2010 CF-3041399 which was flagged as deferred. Not sure how long a deferred should be left without re-investigating it.
Vote by John W.
1021 | March 25, 2017 12:17:59 PM GMT
+1 worked in tags and it makes sense to keep working in cfscript
Vote by Evagoras C.
1022 | March 25, 2017 02:10:37 PM GMT
+1 - And already voted for original ticket
Vote by Aaron N.
1023 | March 30, 2017 04:46:25 AM GMT
Hi Adobe, Is this ticket a duplicate of CF-3041399? Or how do they differ? Thanks!, -Aaron
Comment by Aaron N.
1019 | August 01, 2017 07:46:58 AM GMT
We tried fixing this but this has created an ambiguity, the reason being that we are using default keyword for setting the default value for a parameter. A sample example is as follows {code:java} package numeric function f5(arg1 default=2,arg2 default=3) { return arg1 + arg2; } {code} This example could mean two things for the parameter * arg1 as type and default as parameter name with default value initialized to 2. * arg1 as parameter name with default value initialized to 2 Since initializing default values with default keyword has been done earlier, we have to revert the fix for it due to backward compatibility issues.
Comment by Ashudeep S.
27819 | May 15, 2018 01:14:07 PM GMT