Click to Play

Intel's Infoscape Makes Info...
Intel's Infoscape HD display was one of the biggest attractions at CES 2010. Lines of people surrounded the proof-of-concept piece hoping to get their hands on...

Recent Articles

Why Static Methods For ColdFusion Fail
This cropped up on the TDD mailing list and it made me smile so I wanted to share it along with some commentary. A fairly common request from folks in the CF community is for "static" methods...

Installing Coldfusion 9 On Your Windows 2008 Server
This blog is slowly turning into a ColdFusion site it seems :-) Blame ColdFusion for that, it's the one application server that I know a bit about and I really like...

Hal Helms Officially Leaves Coldfusion
About two weeks ago, Hal Helms blogged that he is leaving ColdFusion for Ruby on Rails. Naturally it stirred a lot of the traditional "is ColdFusion dead?" worrying...

New Updates For cf.Objective 2010 Conference
The Content Advisory Board (twelve of last year's speakers) have just finished their initial selection of topics and potential speakers for the four tracks...

Full Review And Thoughts On CFinNC Event
Now that I'm back from CFinNC and (almost) caught up on lost sleep, I wanted to share my thoughts about this event (and the trend it represents).


01.27.10

How To Improve Your CFSCRIPT

By Sean Corfield


One of the new features in Adobe's ColdFusion 9 release that has excited a lot of developers is the broad range of enhancements to CFML's "other" language: CFSCRIPT.

In the past, I've been very disparaging about CFSCRIPT and I've gone so far as to say in several public – and private – forums that I felt CFSCRIPT should be deprecated and no further effort spent on it. It was always a bit half-baked with weird restrictions and lots of important features missing. It was annoying to use, because you often had to switch back to CFML's tags to get things done. With increased use of CFCs, the restrictions in CFSCRIPT made it even more painful to use because you could not specify function arguments easily in CFSCRIPT – no types, no defaults – and you couldn't express a function's access or return type.

When ColdFusion 8 appeared, with so many small improvements in CFSCRIPT, making it a bit more like JavaScript, those restrictions on function declarations were even more frustrating because other parts of CFSCRIPT had finally become almost pleasant to use. I was working with CF8 a lot and found myself using CFSCRIPT more and more because of the more JavaScript-like operators. Consequently, I found myself writing this sort of code a lot:



Ugh! If you're a ColdBox user, you'll be familiar with this because it's Luis's style for writing event handlers. I don't know about you but the more I worked with CFSCRIPT, the more this style of function declaration started to annoy me!

Host Unlimited Websites - Only $7.95 a Month
Get Started Now

So, I started to simply use CFSCRIPT for public functions (and sometimes private ones) and just accepting a return type of "any" (the default) and arguments with "any" type (again, the default). Sometimes I even went as far as using arrayLen(arguments) to figure out whether optional arguments were passed in. Sad, but true. Enter Railo which allowed argument types and defaults in CFSCRIPT (I don't know quite when Railo added support for that but it was quite a long time ago). I still couldn't specify function return types and access but I could at least specify optional arguments properly:



Continue reading this article.


About the Author:
Sean is currently Chief Technology Officer for Railo Technologies US. He has worked in IT for over twenty five years, starting out writing database systems and compilers then moving into mobile telecoms and finally into web development in 1997. Along the way, he worked on the ISO and ANSI C++ Standards committees for eight years and is a staunch advocate of software standards and best practice. Sean has championed and contributed to a number of CFML frameworks and was lead developer on Fusebox for two years.
About ColdFusionProNews
ColdFusionProNews is a collection of news and commentary designed to keep you in step with the ever evolving landscape of ColdFusion environments. News and Advice for ColdFusion Professionals





ColdFusionProNews is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagementnews.com





 
-- coldfusionpronews is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2010 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


WebProWorld Forum eCommerce Trends Become Strategy