The docs seam to indicate that using new when you import rather then new
com.blah is faster as the path is cached how ever I have never tried I can
just take there word.  I'd also assume, like Andrew that this is faster then
the getMetaData() as you also have 1 extra function call.

This is where I read this for reference:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS61C07B60-3D65-4d71-8F2A-8411D8010E60.html

Also as a small note the init method is called automatically when you use
new but not with any of the other create object functions.  Just thought
that was interesting.

Paul

On Thu, Jul 14, 2011 at 8:12 PM, Andrew Scott <[email protected]> wrote:

> That is correct, and in response to your other question regrading import.
> This works in the same way as Java, in other words that means that you can
> import a folder and reference the cfc via just the name as Paul has done.
>
> On a side note I would question which method is actually faster, the
> metadata or the new operand. I would consider that the new operand would be
> faster than using the metadata approach. Anyone actually tried it to see
> what the difference actually is?
>
> On Thu, Jul 14, 2011 at 12:23 PM, Steve Onnis <[email protected]>wrote:
>
>> Ok so if i have a cfc named FooBar.cfc, from within that CFC i can make a
>> call new FooBar() and i will have a new instance of the CFC?
>>
>> -----Original Message-----
>> From: Paul Kukiel [mailto:[email protected]]
>> Sent: Thursday, 14 July 2011 8:55 AM
>> To: cfaussie
>> Subject: [cfaussie] Re: CreateObject of itself
>>
>> Hi Steve,
>>
>> I believe this is what your trying to achieve:
>>
>> http://pastebin.com/hJmsEvaA
>>
>> Running code: http://demo.kukiel.net/cfaussie.cfm
>>
>> Paul
>>
>> On Jul 13, 8:37 pm, "Steve Onnis" <[email protected]> wrote:
>> > Can anyone suggest a way i can create a new reference to a cfc that i am
>> > already in?
>> >
>> > Something like....
>> >
>> > FooBar.cfc
>> >
>> > <cfcomponent>
>> >
>> >       <cfproperty name="fooProp" type="string" />
>> >
>> >       <cffunction name="bar" output="false">
>> >
>> >             <cfscript>
>> >
>> >                   LOCAL.tmpArr = [];
>> >
>> >                   for (LOCAL.i = 1; LOCAL.i LTE 10; LOCAL.i = LOCAL.1+1)
>> {
>> >
>> >                         LOCAL.tmpObj = new this;
>> >
>> >                         LOCAL.tmpObj.setfooBar("Some String #LOCAL.i#");
>> >
>> >                         ArrayAppend(LOCAL.tmpArr, LOCAL.tmpObj);
>> >
>> >                         }
>> >
>> >             </cfscript>
>> >
>> >       </cffunction>
>> >
>> > </cfcomponent>
>> >
>> > Obviously "new this;" wont work.
>> >
>> > I want something to replace
>> >
>> > LOCAL.tmpObj = createObject("COMPONENT", "FooBar");
>> >
>> > Ideas?
>> >
>> > Steve
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "cfaussie" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/cfaussie?hl=en.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "cfaussie" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/cfaussie?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/cfaussie?hl=en.
>



-- 
Paul Kukiel

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to