> Sorry so wordy with so little clarity, probably, but I'll use 
> this example, that I think Neil might have given:
> 
> if(someQuery.recordcount GT 0)
> vs.
> if(someQuery.recordcount)
> 
> The second, while being "true", isn't as "true" as the first.

That's ridiculous, by definition. There are no gradations within truth
values in Boolean logic.

> If I were to switch languages, w/#1 it would be clear that 
> recordcount is numeric, and might shed some light on the 
> language as a whole.

Yes, and I'm normally in favor of explicit, self-documenting code. But this
is a trivial piece of information. It's not like, say, pre- and
post-increment operators in C-style languages. A CF programmer will have to
know the following, for either line of code to make sense:

1. All query objects contain a value called "RecordCount".
2. This value contains the number of records within the query.

Now, those things aren't immediately obvious, and therefore require some
knowledge about CF. But many programming languages allow implicit evaluation
of numeric values as Boolean values, and any programmer who reads the second
line of code will either know that and realize that CF must be one of those
languages, or they won't. If they don't, they will presumably know that
RecordCount is a numeric value, but that CFIF requires a Boolean expression.
They can then see, by simply running the code, that CF can figure out how to
make sense of it. And this is the kind of problem that you only have to
figure out once - the first time you see it, it might be mildly confusing,
but once you understand it you'll never be confused again. This differs from
generally ambiguous code, which requires you to reinterpret it practically
every time you read it.

And of course, we make similar assumptions all the time, when reading CF
code:

<cfset numericvar = "42">
<cfset numericvar = numericvar & "17">
<cfset result = numericvar * 10> <!--- wtf? I thought numericvar contained a
string! --->

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255102
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