Barney Boisvert wrote:
> Don't do that.  What's happening is that the number
> (isthere.recordcount) is being implicitly converted to a boolean for
> the CFIF to process.  Implicit conversion where the destination type
> is something besides String is almost always the devil, end even if
> it's String it's still the devil sometimes.

Personally, I've always seen the implicit type conversions as a feature 
of CFML, not a thing to be avoided.  As the programmer, if you're 
certain a variable will contain data that the language can convert with 
predictable results, then there is no reason not to use it aside from 
personal preference.

Take, for example, pulling a bit value from a database.  Let's use 
isSuperUser as an example in a membership system.  Take the following, 
should it be...

<cfif userInfo.isSuperUser>
OR
<cfif userInfo.isSuperUser is 1>

Is ColdFusion seeing that as a boolean because it came from the database 
as a bit field, or as an integer because the database returned a value 
of 1 (assuming SQL Server here)?  In ColdFusion, it doesn't matter and 
you will get the same results either way without any fuss.


-Justin Scott

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317673
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to