1 Reply Latest reply on Jun 5, 2008 1:10 AM by Newsgroup_User

    Does CFFUNCTION Outside of a Component Create an Object?

    CFLisa
      I created a user-defined function using the cffunction tag, but this function is NOT wrapped within a component (cfcomponent tag); rather, it's created just like functions that are written using cfscript; it's just that my particular function uses the cffunction tag instead of cfscript. I then call the function just like I would call a function written using cfscript: #myFunction(someArgument)#. I would like to know whether this approach will create an object when the function is called. My guess is a resounding no, since this seems to be just a plan old function, and no CFCs are involved. Thanks!
        • 1. Re: Does CFFUNCTION Outside of a Component Create an Object?
          Level 7
          > I would like to know whether this approach will
          > create an object when the function is called. My guess is a resounding no,
          > since this seems to be just a plan old function, and no CFCs are involved.

          Your instincts are correct.

          Ask yourself this: what type of object would it be if it *was* to create an
          object? Could there be a type of object that would be sensible to create
          in this case? No, I don't think so.

          A function is a function, it doesn't matter if the syntax used is CFML or
          CFScript. <cffunction> offers slightly more functionality - the additional
          attributes one can supply - but other than that, they're the same.

          As you allude to, it's the CFC that gets created as an object - via
          <cfinvoke>, <cfobject> or createObject() - not the functions within it.

          Make sense?

          Out of interest... what prompted the question?

          --
          Adam