cfscript v2, as told by Jeff Atwood

Ray’s post from Tuesday on ColdFusion in script on Bolt raised the question:

if you could write 100% of your CFCs in script, how many of you will?

A day later, in a seemingly completely unrelated post, Jeff Atwood said you’re doing it wrong:

I think existing templating solutions are going about this completely backwards. Rather than poking holes in HTML to insert code, we should simply treat HTML as code.

And I love the code snippet that he posts:

Jeff’s post is talking about ASP.NET, but we’re essentially talking about the same thing, right?

Of course, I might be a little biased as it’s the same point I made almost two years ago:

in the current version of CF you have to resort to hacks to keep your code from inflating into a George R R Martin novel [..] You get all the fuzzy wonderfulness of ECMAScript 4, including variable typing, E4X, lots of literals, anonymous and first-class functions, etc. [..] Essentially, itís cfscript on steroids, instead of the semi-afterthought that it is now.

But, you know, the optimist in me just can’t win. I’m going to go ahead and make a prediction now, and challenge Adobe to prove me wrong:

There’s no way we’re going to see something E4X-like with XML fragments built into CF9. If we scream loud enough we might see it in CF10. Maybe.

Which is, as I often say, a real bummer. Because as anyone who has used E4X will tell you, it’s a pretty damn cool way of writing code.