Saturday 6 April 2013

abort

G'day (again):
Can anyone point me to where in the ColdFusion CFML docs that it tells us that the CFScript syntax for this:

<cfabort showerror="My error message">

Is this:
abort "My error message";


Rather than this:
abort showerror="My error message";

The rule seems to be that if there are multiple attributes for the tag, then the CFScript equivalent is simply "remove the '<cf' and the '>', but otherwise use name/value pairs for the attributes", eg:

component implements="IFoo" extends="Bar"

However if the tag only has the one attribute - eg: <cfabort> - then one doesn't specify the attribute name (as per the example above).

Update:
Although the rule is not hard-and-fast. Consider include:

include "inc.cfm" runonce=true;

This is a mixture of both approaches. I am beginning to think there was no planning on the part of Adobe here at all.

And then there's some tags which have been implemented differently again, like writeDump() and throw(), which are kinda functions. Although throw is also implemented as a statement, ie we have both:

throw(message="foo", type="BarException");

and

throw "foo"; // it's the message, not the type, unfortunately.

Also - more weirdness - some of these new functions like writeDump() take name/value pairs as arguments, but most functions don't. This is all getting a bit PHP-ish, so I'll stop this digression as it's not one of CFML's proudest moments.

Anyway, if you can point to me where the <cfabort> / abort thing is in the official docs, you win a pint! Let me know where it is...

--
Adam