Question

Is output="false" needed for all cfc method written in CFML? or it'd be okay as long as the outer most caller function has output="false"?

What if we don't add output="false" on any CFC methods, but we make sure the top-most caller is inside a <cfsilent> block? is that okay?

Is output="false" solely for suppressing whitespace? I recall years ago CFer's said having output="false" helps with preventing memory leak: myth or fact?

Was it helpful?

Solution

Unfortunately, in Adobe ColdFusion, output="false" at the component level does not affect each individual function, just the constructor area. This may not even matter because I can't think of a way to output anything from the constructor, and indeed, even changing to output="true" seems to make no difference.

I have now (thanks to you, Henry) experimented with chaining functions with output="false", and your suspicions are right - a calling function with output="false" will suppress the output from any function it calls. This was in Adobe ColdFusion 9.0.1.

Adding a cfsilent around the initialization of a component will mute output from the component without an output="false", but again I don't think that does anything. Putting around a function call will mute any output from anything it calls.

output="false" is solely for whitespace suppression. You could argue that adding whitespace to the output buffer would increase memory usage, per request, but I wouldn't really call it a leak - perhaps if you have tens of thousands of component/function calls, it could cause trouble.

Output="true" does have a different effect, treating a function as if it has <cfoutput> tags wrapped around it, and evaluating any # dynamic things automatically.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top