This one was met with a round of applause last night in Dallas. In Scorpio you can now use the following in CFML expressions:
++ -- % += -= *= /= %= && || !
In addition, in you can use the following operators:
== != >=
ColdFusion And JavaScript Like Operators
19 Comments
M
Rick,
I'm willing to be that with CF being dynamic and all that this will work for you:
<cfset foo += "some string" />
R
pretty awesome Ben!
I hate doing
<cfset foo = foo + 1>
Now I can do
<cfset foo++>
Now if you can add a &= operator.
<cfset foo = foo & "some string">
becomes
<cfset foo &= "some string">
S
a = (b == true) ? c : d; is called a ternary operator. ;)
M
IIF() was slower than CFIF in earlier versions of ColdFusion but in MX they compile down to the exact same code.
J
This is AWESOME!!! It is so irritating not having the incremental operators. That will be awesome. It only makes sense, getting closer to ECMAScript.
Now, to go for the mile.. ;-) I agree with Kevin that it would be awesome to have support for ? as in:
a = (b == true) ? c : d;
H
that's pretty cool!
B
#ERROR!
T
Steven said:
True Ben, but please realize that we're REALLY grateful for the inch! :)
hell, we are :D
Cheers, Thomas
S
Ben said:
Give them an inch and they want a mile.
True Ben, but please realize that we're REALLY grateful for the inch! :)
Steven
K
Kevin
That is awesome, I'm very excited about the new operators. I have a question though. I've been told IIF is very slow. Is the following going to work?
a = (b == true) ? c : d;
K
Great to have you in DFW! A question came to mind about the CFIMAGE tag. Currently we have an image server which we use some of the same functionality you talked about with CFIMAGE. Will there be any caching available of images (or is that me just dreaming to big)? Can you manipulate the DPI? We keep hi-res JPEGs (300 dpi) for print and then our image server renders them as 72 dpi for display.
I am so very, very excited and can't wait for the release of CF8. Thanks for your wonderful presentation last night!
B
Give them an inch and they want a mile. ;-)
Thomas, interfaces are in Scorpio, but no plans for for class creation in script. And, without starting a big debate on the subject, I would be very opposed to this idea myself. If you want components defined as classes, well, use Java, it does it really well. But, ya never know.
--- Ben
T
Yay, finally! Good one :)
Ben, say are there by any chance plans to give developers the oppertunity to write cfc's *completely* on a script basis, too? Like defining a component with a class (~component) keyword rather than using the tag syntay? Also, will there be mechanisms like interfaces or abstract classes in CF++? ;)
Cheers, Thomas
S
I may have clapped the loudest for this, lol. Love the idea, finally a ++, and a % for CF!
And bravo for figuring out the validation nightmare that must have been "if(a<b) || (a>c)". It sure looks like it should validate as a tag, but grats for figuring it out and including it! Well done!
Do we call it CF++ now? :)
B
>> Can you manipulate the DPI? We keep hi-res JPEGs (300 dpi)
>>for print and then our image server renders them as 72 dpi for display.
Kevin, no, this is not supported at this time.
--- Ben
C
Rick,
Not sure why, it's not in the list.
But, you can do &= for string concatination.
(The tour just came through PDX on Monday).
Awsome stuff.
I'm excited to be a CF developer.
S
Finnnnnnnnnnnally! This is a feature that has been missing for a long time. ;)
D
Dustin
One thing I've missed is the ability to effectively loop a query in script. Something like this would be awesome:
forin(query||struct[,item]){}
S
sal
sooo! wicked! definitely past due