February 24, 2014
Language Enhancements in ColdFusion Splendor
Comments
(12)
February 24, 2014
Language Enhancements in ColdFusion Splendor
Newbie 8 posts
Followers: 0 people
(12)

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. 
We will be doing a series of blog posts on language enhancements and this post will only be on the Script support for tags. 

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:

  1. cfmodule based custom tags (supported in Splendor)
  2. cfm file based custom tags (supported in Splendor)
  3. 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.

12 Comments
2015-02-28 17:03:43
2015-02-28 17:03:43

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?

Like
2014-03-13 23:08:45
2014-03-13 23:08:45

I have install cf10 developer edition in my xampp but after that Apache is compulsorily shutdown it is refuse to start .help me to over come this

Like
2014-03-04 10:49:15
2014-03-04 10:49:15

@Tom, given there’s now cftransaction and transaction, cflock and lock, cf… and …, there are multiple incompatible script-based ways to do many common tasks!

Like
2014-02-25 00:58:22
2014-02-25 00:58:22

“Yes, the old CFC funtions (Mail, Query, etc) will still be available for backwards compatibility.”
So they’re depreciated then ? Or are there really going to be two parallel and incompatible script-based ways to do common tasks like email and SQL ?

Like
2014-02-24 23:24:14
2014-02-24 23:24:14

@Stephanie,
It seems cfloop is one of the case which needs special handling. Will look into this and update you with more detail later.

Like
2014-02-24 22:08:31
2014-02-24 22:08:31

Hi CFTeam,

any reason why cfloop(from=”1″, to=”10″, index=”i”) {} and cfloop(list=”a,b,c” index=”lst”) {} do not work? It is a little weird that these basic loop types are not working properly.

Steph

Like
2014-02-24 20:44:34
2014-02-24 20:44:34

@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.

Like
2014-02-24 13:20:22
2014-02-24 13:20:22

@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…

Like
2014-02-24 10:55:50
2014-02-24 10:55:50

Any reason why all the script functions still have CF at the beginning when previous functions did not? Seems random to have half the functions with cf and half without. For example, cfproperty is just property, etc.

Like
2014-02-24 08:03:40
2014-02-24 08:03:40

The Elvis operator is backwards in the list of enhancements. 😕 -> ?:

Like
2014-02-24 07:38:07
2014-02-24 07:38:07

So are the old Mail/Query/etc CFCs now not meant to be used ?

Like
2014-02-24 05:18:59
2014-02-24 05:18:59

Is there a reason that prefixed custom tag libraries aren’t supported? Why only support the other 2 ways?

Like
Add Comment