New ColdFusion 8 Operators Rock!

Since I first started using ColdFusion (in the late 20th century), I have loved the language. Once of the few things I haven't loved about it, however, is the absence of JavaScript-like operators that so many other languages have.

[More]

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Those are nice. I also really like implicit structure and array creation:

myStruct = {key1 = "val1"};
myArray = ["val1","va12"];

and most of all:

<cfloop array="#myArray#" index="myIndex">
# Posted By Bob Silverberg | 10/24/08 8:42 AM
Indeed! I have been taking advantage of those as well.

I am hoping that implicit array and structure creation is improved a bit in ColdFusion 9 though.

I like array looping, but it doesn't work as I had hoped. Still nice for certain situations though.

I am using file looping extensively on my current project - very nice!
# Posted By Steve Bryant | 10/24/08 10:25 AM
Yeah, really liking the new syntax. Don't forget the logical operators as well such as:

OR = bValue1||bValue2
AND = bValue1&&bValue2
NOT = !bValue
EQ = bValue1==bValue2
# Posted By John Whish | 10/27/08 2:10 AM
i'll be more happy when we ca do:

<cfset a = {key1 = ["val1","val2"], key2={key1=1, key2=2}}
# Posted By dfguy | 10/27/08 7:23 AM
John,

Good point. I haven't tried those yet. Most of them don't look like real time-savers over the existing syntax, but I have always really liked the "!" operator. It is clear and concise.

dfguy,

You can do that in ColdFusion 8.01.

What you can't do is <cfloop collection="#{one=1,two=2}#" item="key">, which would be really nice.
# Posted By Steve Bryant | 10/27/08 8:49 AM
Hi Steve,

You're right it's not much of a time saver.

I tend to use them when I'm writing in script blocks as it just looks right. Having said that the logical operators look really odd in tag based cfml!
# Posted By John Whish | 10/27/08 9:43 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.