Status/Resolution/Reason: To Fix//Investigate
Reporter/Name(from Bugbase): Aaron Neff / ()
Created: 08/17/2018
Versions: 2018
Failure Type: Others
Found In Build/Fixed In Build: /
Priority/Frequency: Normal /
Locale/System: / Platforms All
Vote Count: 0
ER for: Disableable scope shadowing
Currently, CF allows its scopes to be shadowed and inaccessible to permit sloppy code like Example 1 and Example 2:
Example 1:
-----------
<cfscript>
q = queryNew("id,application", "integer,varchar", [[1,"automotive"],[2,"agriculture"]])
cfloop(query=q) {
writeOutput(application)//!?!? should be unambiguous writeOutput(q.application)
}
</cfscript>
-----------
Example 2:
-----------
<cfscript>
function f(string url) {
writeOutput(url)//!?!? should be unambiguous writeOutput(arguments.url)
}
</cfscript>
-----------
Suggestion: per-app setting THIS.enableScopeShadowing=true(default)|false
Default THIS.enableScopeShadowing=true preserves backward-compat.
Optional THIS.enableScopeShadowing=false allows scope names to always be invoked first
Related URL: https://docs.lucee.org/guides/developing-with-lucee-server/language-syntax-differences.html#scope-names-cannot-be-overwritten
Attachments:
Comments: