I only recently learned about the CFML Advisory Committee, but I was impressed that such a thing would even exist. I suppose with two open source CFML engines (Open BlueDragon and Railo) it was only a matter of time, but without buy-in from Adobe the utility of such an organization is seriously limited. Fortunately Adobe has bought in and has members on the committee.
I'm not sure what percentage of my time I spend working with ColdFusion, but whenever I do I always run into arbitrary limitations or inconsistencies that are incredibly obnoxious. It gives ColdFusion the feeling of a language that was started by one group of people, picked up half-finished by another group with many features are implemented very shallowly in order to meet a ship date. And all too often Adobe never looks back to address those flaws. Hopefully the CFML Advisory Committee will address these flaws.
A great example blatantly rushing a feature is the implicit creation of structs and arrays. With the initial release of ColdFusion 8.0 you could use { } and [ ] notation to create both inside of a CFSCRIPT block, but you couldn't nest them until the release of ColdFusion 8.0.1
<cfscript> // This only works in Adobe ColdFusion 8.0.1+ someStruct = { key1 = { subKey1 = 'xyz' } }; </cfscript> |
I'm hesitant to email my entire wishlist the Committee as Sean suggested, but I did want to write it out and solicit some feedback. Some of these are specific to Adobe ColdFusion (such as var declaration positions), and there is the possibility that some of the issues are fixed or under consideration to be fixed in the upcoming release of CF 9 Centaur.
ColdFusion/CFML Wishlist (or gripes)
- Consistency between cfscript, cfml functions. cfquery, cfdump, and all of the other functions missing from CFSCRIPT
- Allow var declarations anywhere (Note: Supported in OpenBD)
- Fully document CFQUERYPARAM type mapping (cf_sqltype_* to actual SQL type)
- Fully document the SQL commands/functions available for CFQUERY Query-of-Queries
- Ordered structs – I can't think of a good reason not to preserve the order of items.
- Implicit creation of structs with case sensitive names and names containing spaces
<cfscript> struct = { 'one key' = 'abc', 'mixedCase' = 'def' }; </cfscript>
- Support a more standard struct declaration format.
<cfscript> struct = { key: 'val', orKey => 'val' }; </cfscript>
- Pass implicitly created objects as function arguments.
- Allow [] notation to append to arrays.
<cfscript> someArr = [ 'one, 'two', 'three' ]; someArr[] = 'four'; // someArr is now [ 'one, 'two', 'three', 'four' ] </cfscript>
- NO WHITESPACE RESIDUE FROM ANY CFML CODE – Seriously, don't leave a mess when you're parsing. Every byte counts.
- Defined way to pass any variable by reference
- Allow optional args and default values in cfscript function declarations
- True eval() function. I want to be able to dynamically parse code. DE and EVALUATE are about as healthy as cigarettes.
- Public/private key encryption added to cfencrypt w/o needing Bouncy Castle. OK, this one is probably just for me :)
- Zero-based arrays. I bet people that like 1-based arrays also hang their toilet paper under instead of over. Savages.
- A better way to handle caching, such as named caches so that you can expire individual caches easier if/when they need to change. (Note: Supported in OpenBD and Railo)
- Dynamic function calls. Also check out the PHP call_user_func_array function.
<cfscript> function printPrefix(str) { writeoutput("PREFIX: #str#\n"); } func = "printPrefix"; #func#("test"); // Outputs: // PREFIX:TEST </cfscript>
- Ternary operator. WTF? Anyone who is thinking about suggesting IIF should stop right now. IIF doesn't even come close to being true ternary operator.
- Improved For-In loops – Loop through structs with keys/values, like foreach in PHP
<cfscript> for( key => val IN someStruct ) { writeoutput("someStruct[#key#] = #val#\n"); } </cfscript>
- StructValueArray – Return an array of all the values from a struct (just as StructKeyArray returns an array of all the keys). (Note: Matt has requested this for OpenBD.)
In a perfect world things like zero-based array indexes and ordered structs could be set at the application level to maintain backwards compatibility, but I'd even settle for server-wide.
Leave a comment if I'm missing compatibility for one of the CFML engines and I'll update the post accordingly.


