I am going to attempt to document all of CFScript, as a resource for people migrating from old-school tag-based code to script-based code. The reason I am doing this is because neither ColdFusion nor Railo provide much (or in the case of Railo: any) useful documentation of CFScript.
This is not a document for converting tags to script. It is not written from a point of view of "if you use
<cfsometag>then you need to instead use [some script construct]". It simply documents CFScript. It does - however - set out how to perform all CFML functionality using CFScript. It is also not an exercise in teaching CFML (or at least the script part). It assumes you know what you're doing, and is purely a reference. I am contemplating another article / series of articles which teach CFML correctly (the various resources that exist to do this all take the wrong approach, and are a barrier to CFML uptake, IMO). [ed: obviously that plan has been permanently shelved now].
Also there won't be a great narrative structure to this article. It's just a loosely-structured series of sections covering coding topics.
I assume Railo 4.2 or ColdFusion 11, except where stated.
Update:I have ported this stuff to GitHub. See "CFScript docs now on GitHub". The version below is a mirror of that. Given it's on GitHub, if you see any problems or want to augment these docs: DIY, and send me a pull request. Cheers.
FootnoteHalf way through writing this I shifted my dev focus away from CFML to PHP ("So long, and thanks for all the CF"), so the last few sections were, admittedly, rushed. Sorry about that. If anyone wishes to donate better examples, stick 'em in a gist and add a comment here: I'll integrate them into the article. Likewise, if I've out-and-out forgotten anything, pls lemme know and I will update the article.
Footnote 2I used James Ward's approach to embedding a file from Github inline, as detailed here: Dynamically Rendering GitHub Files in Web Pages. Thanks James.