I equate "pointer" with "reference" so that may be where we crossed
wires.
Jim Davis
-----Original Message-----
From: Simon Horwith [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 02, 2003 6:28 PM
To: CF-Talk
Subject: RE: Duplicate() and CFCs cause JRUN Servlet Error (500 Null)?
no, the point is for ColdFusion to support the use of Objects, and it
just
so happens that in CFML you need to create an instance (a pointer, if
you
will) of an object and then call methods and access properties in order
to
manipulate and access data in that instance. Nowhere has anybody
written
that it's a good idea to instantiate an object and then create variables
that are copies of that instance. In fact, it is a very bad idea. If
what
you need is for a pointer to an instance of an object to exist in more
than
one place (or in a place different than it exists now) then you
shouldn't be
using the duplicate() function... and it makes perfect sense to do it
when
need-be. If what you need is a complete seperate copy of a component,
it
makes more sense to explicitily create another instance.
~Simon
Simon Horwith
CTO, Etrilogy Ltd.
Member of Team Macromedia
Macromedia Certified Instructor
Certified Advanced ColdFusion MX Developer
Certified Flash MX Developer
CFDJList - List Administrator
http://www.how2cf.com/
-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED]
Sent: 02 November 2003 20:51
To: CF-Talk
Subject: RE: Duplicate() and CFCs cause JRUN Servlet Error (500 Null)?
I'm a little confused here. I thought the whole point of objects was
to
pass around references to them? (As opposed to replicating data and
code)
My Festival object contains collections of references: "Events",
"Venues", "Attributes" and "Artists". Each "Venue" component contains
references to those collection defining it parent (if any) and
children.
By passing the reference I'm able to change a Venue component data
which
is then reflected immediately in anything that references it.
This all works beautifully. The problem here is that I WASN'T passing
around a reference but rather try to duplicate the CFC (which, since
it's self-referencing, looped off into oblivion since it appears
Duplicate() can't handle self-references). I agree that you shouldn't
be replicating components (at least not like this) - but passing
references is what the whole game's about.
Or so I thought. what am I missing?
Jim Davis
-----Original Message-----
From: Simon Horwith [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 02, 2003 3:42 PM
To: CF-Talk
Subject: RE: Duplicate() and CFCs cause JRUN Servlet Error (500 Null)?
like I said, I haven't had any problems doing thins like this
personally...
but as a best practice, you shouldn't be passing around references to
objects of any sort... java, component, com, or corba. If I need to
replicate an object instance, I generally loop over it with a for (foo
in
bar){} type loop and create keys with the same names and values in the
secondary structure. I also have to add a little isdefined() code to
handle
java null pointers when the object instance in question is of type
java.
~Simon
Simon Horwith
CTO, Etrilogy Ltd.
Member of Team Macromedia
Macromedia Certified Instructor
Certified Advanced ColdFusion MX Developer
Certified Flash MX Developer
CFDJList - List Administrator
http://www.how2cf.com/
-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED]
Sent: 02 November 2003 20:07
To: CF-Talk
Subject: RE: Duplicate() and CFCs cause JRUN Servlet Error (500
Null)?
Yeah - I was just assuming (bad word! Maybe "hoping" is a better
one)
that duplicating a structure containing a reference to a CFC would
duplicate just the reference to the CFC and not try to dupe the
whole
CFC. doesn't appear to work however.
At the moment I'm trying to integrate a new, CFC-based application
into
an older framework. I've got it working now with by using
structdelete() to drop the CFC reference before I dupe it. Next
step
is
convert the whole shebang into CFCs - then the problem will just go
away
as I won't need to do this loop over the struct.
Jim Davis
-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 02, 2003 2:54 PM
To: CF-Talk
Subject: RE: Duplicate() and CFCs cause JRUN Servlet Error (500
Null)?
I know the top level thing you are duplicating isn't a CFC, but
duplicate does not work correctly on CFCs, so if your struct
contains
one, you can't/shouldn't call duplicate on it.
_____
_____
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

