While demoing the ORM features in Centaur (CF9) and Bolt (the CF IDE) during the MAX keynote, I showed and executed some code, and this snippet appeared on the screen for a short time:























I have now received three e-mails asking if that code was real or not. And the answer is yes, that is real code generated by Bolt, and it really was running in Centaur. Really! And yes, I know the code is not great (heck, it’s not even that good, good thing we’re not shipping yet).
But, you have to wonder, what made them ask? And did we inadvertently let a CF9 enhancement slip out of the bag? 😉

8 thoughts

  1. Is there an example of why allowing the var scoping of variables anywhere in the function be a benefit?

  2. i suppose if nothing else, it just offers for a bit more flexibility.
    <cfif condition>
    <cfset var myVar = "foo" />
    <cfelse>
    <cfset var myVar = "bar" />
    </cfif>
    …without having to explicitly set the <cfset var myVar = "" /> prior to the conditional (but you still could if you wanted to predefine the vars at the top of the function body).

  3. "Is there an example of why allowing the var scoping of variables anywhere in the function be a benefit? "
    I think the real question is, "is there a benefit to limiting declaration of function local variables to the beginning of the function?"
    I would say that there isn’t. Everywhere else that I ‘declare’ local variables I do so as close to the usage of the variable as possible, the current requirements for var break that proximity convention that can be used in: C#, JavaScript, ActionScript, Java and elsewhere in CF. (note: I am not thinking strictly of the keyword var in this observation, but local variable declaration).

  4. I am sooooooooooo excited I wont be able to sleep tonight. Ohhhhh Ohhh :
    <cfset var Destination = EntityLoad("Destination", {}, "#arguments.gridsortcolumn# #arguments.gridsortdirection#")/>
    I’m way to excited about this.

Leave a Reply