Did you know there exist an IMP operator in ColdFusion? Well, i didn't even after 8 years of day to day ColdFusion usage.
Found it accidentally when trying to have a variable name IMP.
For thouse who find IMP new too, here is how it work:
As opposite to AND and OR:
Categories
| ColdFusion | 142 | [RSS] |
| Other | 88 | [RSS] |
| My Projects | 56 | [RSS] |
| Fun | 41 | [RSS] |
| SQL | 33 | [RSS] |
| RIA | 18 | [RSS] |
| 1ssBlog | 16 | [RSS] |
| Deals | 13 | [RSS] |
| cfSQLMaster | 12 | [RSS] |
| Caching | 8 | [RSS] |
| Profit | 7 | [RSS] |
| cfHSSF | 5 | [RSS] |
| Transerfing | 5 | [RSS] |
| AJAX | 4 | [RSS] |
| cfFirewall | 4 | [RSS] |
| cfWatcher | 4 | [RSS] |
| JavaScript | 3 | [RSS] |
| 1ssChat | 2 | [RSS] |
| Adobe Air | 1 | [RSS] |
| Security | 1 | [RSS] |
Recent Comments
- On Consumer Password Worst Practices
Ed said: Gary, i totally agree on the hash usage. What about Jessica... to me the other names getting such a... [More] - On Consumer Password Worst Practices
Gary F said: Great post Ed! This is fascinating stuff. 600,00 people are looking at that top 20 list of passwords... [More] - Congratulations To All Women !
Ed said: No worries at all ;) I don't pay much attention to such things and take everything (or at least try... [More] - Congratulations To All Women !
Gary F said: Ed, my comment was very much tongue in cheek. I was not being hostile to you at all, I was poking fu... [More] - Congratulations To All Women !
Ed said: Well.. first of all i really don't understand your hostility to me. I don't think i made anything to... [More]
CFBloggers
Flex In The White House Situation Room
More fun with the (ColdFusion) truth
Hello World
ColdFusion true is not a Java boolean
360Flex SJC 2010: Flex and Silverlight stack comparison Slides and Sample Apps
360Flex SJC 2010: Adobe Stratus and FP10.1 P2P Slides and Sample Code.
ColdFusion Job Opportunity in New York, NY
More fun with the (ColdFusion) truth
Hello World
ColdFusion true is not a Java boolean
360Flex SJC 2010: Flex and Silverlight stack comparison Slides and Sample Apps
360Flex SJC 2010: Adobe Stratus and FP10.1 P2P Slides and Sample Code.
ColdFusion Job Opportunity in New York, NY
Calendar
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
Adobe Feeds
- Underused Google Product Search To Be More Useful
- OVI Suite 2.1.1 update available
- CMX Masterpiece Photo Collection 14: The Adventures of Sherlock Holmes
- Introducing CMX Masterpiece Photo Collection 14: The Adventures of Sherlock Holmes
- Thunderbird Beta 'Lanikai' Released
- Mission critical Flash
- Flex In The White House Situation Room
1ssBlog was created by Ed Tabara and is running version 1.1.


Cheers for the heads up.
Ike: you might want to revisit the logic of your assertion there I think: they're not the same.
Ed: your summary of how the processing of IMP is short-circuited is spot on, but it's not telling the whole picture.
If the first operand is true, then we care about the second operand, and that operand must be true for the expression to be true. If the first operand is false, the expression is true irrespective of the value of the second operator.
This is very interesting. I wonder how much of my mangled boolean contortions could have been avoided had I known about this.
Cheers!
--
Adam
So IMP works like this:
T+T = T
T+F = F
F+T = T
F+F = T
In ColdFusion, NOT x AND y is
T+T = F
T+F = F
F+T = T
F+F = F
(Remember NOT has higher precedence than AND.)
It's closer if you write NOT (x AND y):
T+T = F
T+F = T
F+T = T
F+F = T
But what you really want is NOT (x AND NOT y). And if you find yourself wanting that, then IMP would definitely be easier! (Although it might not be as understandable ... I think you'd want to comment that code.