12 Sept 2014

CFScript v2 – go vote for it!

CFScript is an inconsistent mess. Some statements take the form of functions while tags like cfloop are still named as cfloop in cfscript rather than just loop. Take a look at this:

cfloop(from=1, to=10, index=1){
     //stuff
}

Huh? Why shouldn’t a more JavaScript-like syntax be used rather than trying to replicate the tag’s BASIC-like syntax as literally as possible. It’s like trying to fit a square shape through a triangular hole. Sure, if you bang it enough it might go through, but it’s messy and you know it’s wrong.

No new developer should have to learn this conflicting, inconsistent, scripting language. It should be trashed but retain 100% backward compatibility.

How? Adam Cameron raised some inconsistencies of cfscript in his blog and without much thinking I suggested something simple to allow a new, clean scripting language to be used without having to throw away legacy code:

<cfscript version=2>
      // new code goes here
</cfscript>

When the CFML engine sees that version 2 is stated a new interpreter kicks in to compile it to Java. Obviously if version 1 is stated, or nothing at all, the legacy interpreter is used.

This feature suggestion has been added to Adobe’s bugbase. Please go and vote for it!

Adam picked up on my moment of clarity and blogged again with some great feedback from the CFML community.

V2 implemented this way will guarantee backward compatibility and wipe the slate clean to attract newcomers to CF and utilise it based on what they know from a more elegant, universal syntax such as JavaScript. Tagged based scripting and CFScript v1 are both a non-starter for newcomers who want to start a programming career. It's time Adobe think of the future, stop adding poorly implemented features that no one wants to use (cfclient?) and go back to the drawing board and get the language right without having to throw the baby out with the bath water.

Go vote now. You’ll need an Adobe ID to log in before you can vote.