Created
February 24, 2012 14:01
-
-
Save bennadel/1901105 to your computer and use it in GitHub Desktop.
ColdFusion 10 Beta - Miscellaneous Parsing Bugs And Oddities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// None of the following three return() statements work when used | |
// in conjunction with implicit-notations for ARRAY, STRUCT, and | |
// CLOSURE. Must return "( )" from return statement in order to | |
// parse properly. | |
function returnImplictNotation(){ | |
return( [ ] ); | |
return( { } ); | |
return( function(){ } ) ; | |
} | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Function expressions / closures cannot be defined in the | |
// context of an implict struct. | |
udfs = { | |
doThis: function(){ }, | |
doThat: function(){ }, | |
}; | |
// Function expressions / closures cannot be defined in the | |
// context of an implict array. | |
callbacks = [ | |
function(){ }, | |
function(){ } | |
]; | |
</cfscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Define our UDF to pass into the thread. | |
doSomething = function(){ | |
// ... | |
}; | |
// Spawn a thread and pass-in the UDF as an attribute. | |
thread | |
name = "testFunctionCall" | |
action = "run" | |
udf = doSomething | |
control = "Simple Value" | |
{ | |
// As a "control", export the simple value. | |
thread.control = attributes.control; | |
// Invoke off of attributes -- for some reason, this throws | |
// an error (regardless of whether or not the given function | |
// is a standard function or a closure). It can be invoked | |
// without scoping... but NOT with it. | |
attributes.udf(); | |
} | |
// Join the thread so we can see the output. | |
thread action = "join"; | |
// Outpu the thread properties. | |
writeDump( cfthread ); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment