Status/Resolution/Reason: Needs Review//NeedMoreInfo
Reporter/Name(from Bugbase): John Whish / ()
Created: 04/28/2018
Components: Language
Versions: 2018
Failure Type: Enhancement Request
Found In Build/Fixed In Build: 2018,0,0,308164 /
Priority/Frequency: Normal / All users will encounter
Locale/System: / Platforms All
Vote Count: 3
Problem Description:
If you use `final` for a variable in a function, to function scope it you need to do `final var myvar` to stop it bleeding. The extra `var` seems unnecessary to me. I'd like it if the foo example below worked as the bar one does.
```
<cfscript>
function foo(){
final a = "One"
return a
}
function bar(){
final var b = "Two"
return b
}
x = foo()
y = bar()
writeOutput("IsNull(a): #isNull(a)#<br>") // NO
writeOutput("IsNull(b): #isNull(b)#<br>") // YES
writeDump([x,y])
</cfscript>
```
Example:
https://trycf.com/gist/a677906474c0912d0838728dbd5944f1/acf2018?theme=monokai
Steps to Reproduce:
Run this:
https://trycf.com/gist/a677906474c0912d0838728dbd5944f1/acf2018?theme=monokai
Actual Result:
Without `var` the variable bleeds.
Expected Result:
`final` should imply `var` so that the variable does not bleed.
Any Workarounds:
Use `final var`.
Attachments:
Comments: