Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created February 24, 2012 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bennadel/1901105 to your computer and use it in GitHub Desktop.
Save bennadel/1901105 to your computer and use it in GitHub Desktop.
ColdFusion 10 Beta - Miscellaneous Parsing Bugs And Oddities
<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>
<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>
<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