I favour XML syntax for the same reasons a spike.
Especially when reading a cfmodule. (bad, I know. Not my code). It's
annoying to have to wonder whether that's it at that stage, or the
cfmodule wraps around other logic.
It's not goint to take much to make it xml, though:
Why is cfset not well formed xml?
<cfset foo="bar" /> is valid, as is
<cfset var foo = "bar" />. var is a valueless attribute. (I forget the
technical term, but they are allowed, like the checked attribute in
certain xhtml form tags)
cfreturn, then by the above meaning, is also well formed, but it lacks
meaning. Something like <cfreturn value="foo"> would give meaning.
That leaves cfelse. It could be dropped in favour of something like
JSTL's <choose>. Syntax from memory is something like:
<choose>
<when test="foo">
<!--- Do stuff --->
</when>
<when test="bar">
<!--- Do stuff --->
</when>
<otherwise>
<!--- Do stuff --->
</otherwise>
</choose>
Barney Boisvert wrote:
One point that should be made is that CFML is not XML, no matter how
it's written. CFELSE, CFSET and CFRETURN are three examples of tags
that simply cannot be valid XML. If you use a subset of CFML, you
could make for a valid XML document, but you'd be crippled.
This is one interesting feature of recent versions of JSP. JSP
documents are valid XML, so you can do some neat things with XSLT and
such to actually manipulate the code of you app, not just the data it
manages.
cheers,
barneyb
On 7/28/05, Spike <[EMAIL PROTECTED]> wrote:
I write code that way because it is required when writing XML and valid
XHTML. It's simpler for my poor old brain to remember to always do it
that way than to do it one way in most tag based languages and another
in ColdFusion.
It also makes code more readable for me because it is a more declarative
style.
If I see this:
<cfhttp url="blah">
There may or may not be a </cfhttp> somewhere further down the page,
whereas if I see this:
<cfhttp url="blah" />
I know there isn't one.
Spike
--
Haikal Saadh, Applications Programmer
Teaching and Learning Support Services
K405, Queensland University of Technology, Kelvin Grove Campus
[EMAIL PROTECTED], 3864 8633
CRICOS No. 00213J
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]