I believe that since CF now is just Java, the Java rules apply, so only primitives are copied by value.

-Matt

On Wednesday, June 11, 2003, at 04:50 PM, Nathan Dintenfass wrote:

I have no problems saying:

arrayLen(componentInstance.getArray());

Where the component has a method called getArray that returns an array
(whether or not the elements in that array are other component instances).
Can you show the code where it's failing?


It's a bit of a bummer that obj.method()[1] does not work, but it's not
surprising that the compiler doesn't like that construct.

You might try:

myObj.getArray().get(0).getInnerObj()

(assuming the first element in the array returned by myObj.getArray is an
object with a method called getInnerObj)


Though, I thought Arrays copy by value, not by reference in CF -- so, you
actually are using more memory for the array itself. No?






-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Jim Mattson
Sent: Wednesday, June 11, 2003 12:28 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Array of Objects?


Hello,


I have a cffunction that returns an array of objects.  I need to store
the array of objects into a temporary variable before I use it.  For
example:

myObj = createObject("component", "MyComponent");

I can not do this:
--> ArrayLen(myObj.getArray())
or
--> myObj.getArray()[1].getInnerObj()

I need to change the above syntax to:

myTempArray = myObj.getArray();
ArrayLen(myTempArray);
myTempArray[1].getInnerObj();

Isn't CF forcing us to allocate additional memory space by storing the
array into a temporary array???  Does anyone know why this is
implemented this?




__________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).


---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to