AdobeStock_455007340

CFML Enhancements Coming Soon

In addition to all of the new features planned for ColdFusion Centaur, and the introduction of the new ColdFusion IDE, we’ve also managed to sneak in lots of smaller CFML enhancements, some of which are long overdue. Here are some of what we’ve been working on.

  • Assignments can now be chained, so this will work:
  • Ternary operators are now supported:
  • In ColdFusion 8 we allowed you to create structures and arrays implicitly, like this:

    The problem is that we didn’t quite finish the implementation, and so if you wanted to pass that structure to a tag or function you’d have needed to first save it to a temporary variable, like this:


    This has been fixed in Cenatur, and the following will now work (as it should have before):
  • A new tag has been added, to complement the existing continue CFSCRIPT operator.
  • Support for “finally” has been added via a tag and a finally operator.
  • One of the biggest CFML enhancement is in CFSCRIPT which now supports all of CFML (with minor exceptions where not appropriate). You can now build CFCs entirely in CFSCRIPT, including Application.cfc. You can invoke any tags and functions in CFSCRIPT. You can use new operators like abort, exit, include, and throw, to simplify your CFSCRIPT. In fact, you can now build a complete ColdFusion application entirely in CFSCRIPT, without using any CFML, if you are so inclined.
  • To make the CFSCRIPT enhancements work properly, we’ve also added a few new functions, WriteDump() is the equivalent of , WriteLog()is the equivalent of (both of these are named similarly to the existing WriteOutput() function), Trace() is the equivalent of , Location() is the equivalent of , and Throw() is the equivalent of .
  • ColdFusion variables (including complex types like arrays, structures, queries, CFCs, and Java objects) can be serialized to binary objects using the new SaveCFObject() function, and then deserialized later as needed using LoadCFObject(). These functions can work with variables as well as files, so objects can be serialized to disk and then read later when needed.

And we’re not done yet. Stay tuned, more cool stuff to follow!

28 responses to “CFML Enhancements Coming Soon”

  1. Lionhart Avatar
    Lionhart

    The ternary operator makes me smile, Ben.

  2. Rick O Avatar
    Rick O

    Seconded about the ternary operator. I know the other changes are awesome, too, but I’ve been whining for a ternary operator for 10+ years.

  3. TJ Downes Avatar
    TJ Downes

    So what have these guys been doing with all the spare time they have on their hands Ben?

  4. Jared Shields Avatar
    Jared Shields

    Do you think a CFSCRIPT version of CFQUERY will makes it way in?

  5. Ben Forta Avatar
    Ben Forta

    Jared, yes, it will.
    — Ben

  6. Tony Avatar
    Tony

    I am interested in seeing an application.cfc written entirely in cfscript.

  7. Jared Shields Avatar
    Jared Shields

    Awesome! Now if only a release date would be announced so that we can plan our overhaul w/ ORM integration accordingly…. We’re putting off the integration of Hibernate until CF9 comes out to prevent having to go backwards….

  8. JAlpino Avatar
    JAlpino

    Its great to see these subtleties being included in the new release along with important features like <cffinally>.

  9. Russ Johnson Avatar
    Russ Johnson

    This may not sit with others but I would like to see a new file extension for CFSCRIPT only files. Instead of having to use the CFSCRIPT tags to open and close the file, just name the file FILENAME.CFS or something like that. Not a major thing, just something I was thinking about.

  10. Ben Forta Avatar
    Ben Forta

    Russ, way back in CF5 days we talked about a CFS file, a file which was all CFSCRIPT and did not need the <CFSCRIPT> </CFSCRIPT> tags. Would be a bit trickier now, as we’d need two of those, one for .CFM files and one for .CFC files. But, still a worthy idea for a future enhancement.
    — Ben

  11. Ciaran A Avatar
    Ciaran A

    Thanks for the updates. What will the CFSCRIPT version of <cfquery /> look like?

  12. Sean Corfield Avatar
    Sean Corfield

    "You can invoke any tags and functions in CFSCRIPT."
    Will that include the ability to invoke custom tags in CFSCRIPT?

  13. Bradley Moore Avatar
    Bradley Moore

    Are there plans to skip the "save to a variable" step for functions that return queries/arrarys?
    For example:
    <cfoutput query="returnsAQuery()"></cfoutput>
    Instead of the current way:
    <cfset myQuery = returnsAQuery() />
    <cfoutput query="myQuery"></cfoutput>

  14. Joe Meboe Avatar
    Joe Meboe

    Hi, Ben, still looking for something on SharePoint integration. It would be great to be able to read a SP entry (or a set, possibly a date range) out of SP instead of having to export SP records. Thanks.

  15. Rupesh Kumar Avatar
    Rupesh Kumar

    Russ, For CFCs that are written in cfscript style, you do not need to write <cfscript>. You just write it in the cfscript syntax.

  16. Anthony Avatar
    Anthony

    I can’t wait for SaveCFObject()!!!

  17. Marius M Avatar
    Marius M

    can you comment on any updates regarding exchange (availability of last datetime update of a record) and Sharepoint integration.
    Thanks
    Marius

  18. ziggy Avatar
    ziggy

    >>and Throw() is the equivalent of <CFTHROW>
    So why not Dump() and Output(), etc? Why the verbose addition of "write"?

  19. Manjukiran Avatar
    Manjukiran

    Hi Sean, custom tags are not supported in CFSCRIPT. Also, not all tags can be used in cfscript. We have added script support for most of the frequently used tags – cfquery, cftransaction, cflock, cfmail, cfthread, components, functions, cfthrow, cfrethrow, cffinally, cfexit, etc. Please refer the documentation for the whole list of attributes.
    Some of the tags for which script syntax is not supported – cfpop, cfimap, UI tags like cfgrid, etc.

  20. Sean Corfield Avatar
    Sean Corfield

    @MJ, thanx for the clarification. I’m just looking at the CF9 Public Beta docs now to see what you guys decided to support in the end. Great work!

  21. Randy Leinen Avatar
    Randy Leinen

    Does anyone know if there is support for connecting to more than one datasource in the CF9 ORM? I just read through the beta docs and I don’t see a way mentioned.

  22. Manjukiran Avatar
    Manjukiran

    Hi Randy, ColdFusion-ORM does not support multiple datasources. ColdFusion-ORM is designed to work with one datasource only, which you configure in Application.cfc (this.ormsettings.datasource=<datasourcename>).

  23. Randy Leinen Avatar
    Randy Leinen

    So then, if my application has multiple datasources then I cannot use the new ORM in CF9?

  24. Manjukiran Avatar
    Manjukiran

    There had been a lot of discussions around supporting multiple datasources in Coldfusion-ORM all through the release. We had to make a trade-off between design-simplicity and supporting-multiple-datasources-per-application. We took the approach of keeping the design simple by supporting one-datasource-per-application. For applications which use multiple datasources, you could use the ORM approach for the primary datasource and revert back to the cfquery-based approach for the other datasources. Of-course let us know if you think otherwise.

  25. adam j. sontag Avatar
    adam j. sontag

    I was just looking at the cf9 docs and didn’t see any new functions for creating queries, nor is there one for creating new threads. Is the documentation 100% up to date, or is ORM the only way to access the DB via cfscript?

  26. Randy Leinen Avatar
    Randy Leinen

    @manjukiran,
    I appreciate the info. And I will admit that there is a lot to like and look forward to about CF9. And the ORM looks very promising. However, using an ORM for part of the data access is not a good idea. The benefit of medium to large proje

  27. Russ S. Avatar
    Russ S.

    I’ve written a complete Application.cfc reference in CFScript for Coldfusion 9. You can see it here: http://cfruss.blogspot.com/2009/11/applicationcfc-reference-in-cfscript.html
    It includes all available methods and variables, and is fully commented.

  28. Russ S. Avatar
    Russ S.

    Forgot to include the link to my Application.cfc reference: http://cfruss.blogspot.com/2009/11/applicationcfc-reference-in-cfscript.html

Leave a Reply