Download the public beta of ColdFusion Splendor from here
Various
enhancements have been added to the core CFML language to provide a better
development experience. Script support for CF
tags and member functions for CF data structure were long pending feature requests and we are
happy to add these two along with a few more enhancements in ColdFusion Splendor (codename). The following list shows the enhancements made in the CFML language:
- Script support for tags
- Member functions for CF data type/data structure
- Improved JSON serialization
- Easy to use CF functions for Query tag
- Elvis operator (?:)
- Promoting built-in CF function to first class
- Miscellaneous new functions: QueryGetRow, ListEach and others.
Script
support for tags
Traditionally, while coding in script syntax, you have to switch to tag-based syntax if you have to use CF tags. The reason being, the CF tags, barring
few, were not available in the script syntax. ColdFusion Splendor onwards, most of the ColdFusion tags are made available to be used in the CFScript block. Now, you can invoke most of the CF tags within the CFScript blocks. One more good thing about the current implementation is that it will automatically take care of any future tag being added to the CF language.
Case 1: Simple tag with no child/body.
<cfscript> cfpdf (action=”getInfo”, name=”pdfVar”, source=”CF10MigrationGuide.pdf”); </cfscript>
Note: The tag attributes should be enclosed within the parenthesis and must be comma-separated.
Case 2: Tags with child tags/body.
<cfscript> cfform (name='myForm', acton='') { cfgrid (name="myGrid", query='empQuery') { cfgridcolumn (name='firstName', id='firstName', type='string'); cfgridcolumn (name='lastName', id='LastName', type='string'); } } </cfscript>
Note: The child tag (and the body in general) should be enclosed in curly brackets, as a function block.
Case 3: Custom tag
ColdFusion provides three different ways to write custom tags as shown in the following list:
- cfmodule based custom tags (supported in Splendor)
- cfm file based custom tags (supported in Splendor)
- Prefix based custom tags (not supported)
// Tag based syntax <cf_happybirthday name="John" birthDate="December 5, 1987"> //Script based syntax. <cfscript> cf_happybirthday(name="John", birthDate="December 5, 1987"); </cfscript>
Stay tuned for more on the language enhancements. Please refer to the ColdFusion Splender public beta documentation for more details.
I’ve been looking at a migration from CF9 to CF11. It seems that CF11 denies using to insert code from one file into another if the file being inserted isn’t a CFML (.cfm) file. The system I’m migrating uses to insert .cfx files. Rewriting the code would be onerous. Anybody have ideas on how we can move to CF11 without a rewrite?
@Scott,
This approach has been taken based on the feedback we received on prerelease forum. In the argument given, the CF prefix helps it to look different from regular functions and hence can be easily differentiated. We thought of changing the old syntax too but left it as it is to maintain the backward compatibility. But going forward, we would encourage people to use latest syntax.
@Tom,
Yes, the old CFC funtions (Mail, Query, etc) will still be available for backwards compatibility.
@Justin,
Wouldn’t that be nice. I haven’t tested, but I wonder if the cfimport syntax is supported?
@Scott,
Yes, this is a nice start, but a language overhaul is still necessary. Guess we’ll have to see what CF 12 brings…
You must be logged in to post a comment.