Coldfusion 9 CFScript enhancement
I'm not exactly sure how I missed Ray Camdens post on the proposed CFScript enhancements for ColdFusion 9 but it's never too late to throw in my own two cents. I think it's awesome!
Perhaps that's a little bit too general of an answer that should be backed up a little.
A Real Langauge
One of the big complaints I get from programming "purists" (read:Java Programmers) is that ColdFusion isn't a real programming language, it's a scripting language and a bad one at that because of the bracketing. Now the whole bracketing thing is a kind of lame argument but I do have to agree just a "little" with them on this one. If it wasn't for the code completion in CFEclipse and the other IDE's I would have gone crazy a lot earlier in my career.A Sample
From the screenshot that Ray has on his blog of Bolt one can see the following code snippet.component
{
public void function init(){}
public query function getData(mediaid)
{
var q = new query();
q.setDatasource("cfartgallery");
q.setSQL("select * from art where mediaid = :mediaid:");
q.addParam(name="mediaid",value=arguments.mediaid,CFSQLTYPE="CF_SQL_INT");
return q.execute();
}
}
component
{
public void function init(){}
public query function getData(mediaid)
{
var q = new query();
q.setDatasource("cfartgallery");
q.cachedwithin (createTimeSpan(0,6,0,0));
q.result("myresult");
q.user("mysqluser");
q.password("thepassword");
q.timeout(10);
q.maxrows(100);
q.setSQL("select * from art where mediaid = :mediaid:");
q.addParam(name="mediaid",value=arguments.mediaid,CFSQLTYPE="CF_SQL_INT");
return q.execute();
}
}
A Welcomed Enhancement
Some may not consider the energy that Adobe is investing to enhance CFScript worth it. These are probably the same people who think CFScript should just go away and die a quiet death. I, on the otherhand, welcome any enhancement to CF that may make it easier for other developers to adopt it and see it as a viable alternative to other programming languages.
Whatever Adobe plans to do with CFScript it will be impossible to please everyone.

Subscribe
Subscribe via RSS
Follow me on Twitter
Or, Receive daily updates via email.
Tags
adobe air ajax apple cf community cfml coldfusion examples ext flash flex google javascript jquery max2007 max2008 misc open source programming railo software technology ui
Recent Entries
No recent entries.
Blogroll
An Architect's View
CFSilence
Rey Bango
TalkingTree

But you'll see when CF9 comes out.
Every ask yourself why ArrayAppend et all, return true/false rather than return the object you are working with? What am I going to do with a FREAKING boolean success variable? Okay you failed, well then THROW AN ERROR!
Ever write a large CFScript block only to freaking flip out when you have to implement something not supported in in CFScript, If you are nested in logic you are SOL and have to reactor all your script to tags. Sure I can write wrapper functions but then I am including function libraries all over the place, what is the point. If you can't implement CFScript correctly then DON'T give us some half backed implementation that makes me pull my hair out and play in roads.
Keep CF simple, keep the learning curve low, and concentrate on more valuable enhancements. People who advocate for CFScript should just go program in something else, because your desire is just out of envy.
If you must have CFSCRIPT then allow me to code the example above as:
component
{
public void function init(){}
public query function getData(mediaid)
{
return query().setDatasource("cfartgallery").setSQL("select * from art where mediaid = :mediaid:").addParam(name="mediaid",value=arguments.mediaid,CFSQLTYPE="CF_SQL_INT").execute();
}
}
Sorry to rant, but the CF Teams need to be spending time with other functionality rather than chasing something ColdFusion isn't. Let's stay unique.
I agree that simply extending cfscript is not quite enough :)
Method chaining is an absolute must have, as well as the ability to add in Hibernate meta information (I am just assuming thats going to be included).
But, and here is my big BUT. CFML is a simple language and should remain so but I see no reason not to provide another way of tapping into the power of CF through cfscript.
if that is to be done it must be done correctly and thoroughly and no half-assed implementation like we have now in cfscript.
- new wddx();
- new ajaxproxy()
- new feed()
- new schedule()
but because there is no CFC wrappers for cfwddx, cfajaxproxy, ... you can't. These constructs:
- new query()
- new mail()
are implemented using query.cfc and mail.cfc available in global CFC path and methods like setDatasource() are just CFC methods.
So in other words - Adobe did nothing that you couldn't do on your own.
Why don't we just get rid of tags all-together!!