[thelist] CFMX problem - HTML output cut off - and character encoding

Buffington, Michael michael.buffington at office.xerox.com
Wed Jul 16 03:26:15 CDT 2003


[snip]
it's *quite* wrong if you want your code to be portable to versions prior to
cfmx.  it's also semantically wrong to use <cfset>, a tag used for
assignment, for a simple function call.
[/snip]

This works brilliantly in CF5, but all bets are off for prior versions:

<cfset employee = StructNew()>
<cfset StructInsert(employee, "firstname", "Tom")>

<cfdump var="#employee#">

The second line illustrates the point. If the setEncoding() function worked in CF5, then it too would be able to be called like this. Should it instead be called in cfscript? My personal preference says yes, but that doesn't mean it's incorrect to do it in cfset.

I'd also argue that cfset isn't just a tag used for assignment. It simply, for lack of a better word, executes expressions. The following is perfectly valid, and works just fine in CF5 and up:

<cfset 1 + 1>

The point is, the = symbol is simply an operator. Sure, you get more results with <cfset var = something>, but it's no less valid, syntax-wise, to say <cfset 1 + 1>.

I do, however, agree with you, to a degree. It just doesn't seem right, but it actually isn't incorrect, syntax-wise, performance-wise, or arguably readability-wise. It comes down to personal preference.

Michael Buffington
http://www.michaelbuffington.com/


More information about the thelist mailing list