Monday 28 September 2015

ColdFusion: Adobe chip away at their own crappy generic CFScript syntax

Here's some good news from the Adobe ColdFusion Team: it seems their not opposed to reversing some of their bad language design choices: they're thinking of deprecating cfloop() in favour of extending for().

Background: Adobe had been promising full CFScript functionality parity with tag-based functionality since ColdFusion 9 was in development. CFScript got enhancements in 9, and again in 10, but did not get the 1005 parity until 11. Unfortunately Adobe did a half-arsed job of this and simply implemented the rest of the missing functionality via basically calling tags in script. FFS.

So where we might have had to do this in the past:

<cfloop query="someRecordset" group="someColumn">
    <!--- outer loop stuff --->
        <!--- inner loop --->

Adobe decided this would be a suitable CFScript implementation of equivalent functionality:

cfloop(query="someRecordset", group="someColumn"){
    // outer loop stuff
        // inner loop stuff

Egad. This shows a chronic lack of language design skills, and seemingly a complete unawareness of how any other language might go about things. Why the hell are they still prefixing everything with CF??? How does syntax like that fit in with the aesthetic and precedent of all the existing CFScript implementation? It's just an exercise in laziness and dull-headedness.

Anyway, I've gone on about this enough in the past.

Right, so now we have this ticket (which I only now notice I actually raised!): "Error messaging with cfloop() is rather messed up", which has footnotes:

We will not take this up and might deprecate cfloop() in cfscript altogether in future.


There is an enhancement to support grouped query looping in for() syntax in cfscript. - #3754577. We will not deprecate cfloop before taking that enahancement.

3754577 observes that cfloop() doesn't actually have functional parity with its tag counterpart.

But the important thing here is this bit: "We [...] might deprecate cfloop() in cfscript altogether in future". I'm mad for deprecating cruft from the language, but the more important thing is that it seems if Adobe are actually given better alternatives for their generic tags-in-script functionality, they seem open to deprecating the generic stuff, in place of implementing a better, in-keeping-with-design-philosophy alternatives. This means we can tidy up CFScript a bit, if we put our minds to it.

ColdFusion 2016 is being developed as we speak, and I can speculate that we're possibly in the window for getting stuff done with the language (remember Rakshith promised ColdFusion 2016 would be a dev-centric, language-centric release), so now's the time to get the ideas in front of Adobe.

I've already floated a coupla ideas for improving the current CFScript implementation of some tags:

Those are just a coupla random ideas. What I want to know - and I want to get this info from you lot - is what other areas have Adobe let us all down in falling back to this generic "tag in script" syntax instead of doing a thoughtful implementation.

How would you implement <cfldap>? <cftransaction>? What about <cfmail>? Share your ideas (and get them into the bug tracker).