• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Does CFFUNCTION Outside of a Component Create an Object?

New Here ,
Jun 04, 2008 Jun 04, 2008

Copy link to clipboard

Copied

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!
TOPICS
Advanced techniques

Views

306

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 05, 2008 Jun 05, 2008

Copy link to clipboard

Copied

LATEST
> 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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation