> If you do this:
> 
> <cfset var s = structNew()>
> <cfset s = mystruct>
> 
> Then s is not a struct, but a pointer to mystruct, so 
> whenever you set a property of s, you are in fact setting a 
> property of mystruct.

There are two things worth pointing out here, I think. The first, trivial,
point is that I think you meant to type "<cfset var mystruct =
StructNew()>". The second and more important point is that there's a subtle
error in your conclusion. While "s" would be a pointer to a structure rather
than the structure itself, so would "mystruct"! That is, when you do this:

<cfset mystruct = StructNew()>

the variable "mystruct" is just a reference to a structure object.

When you then do this:

<cfset s = mystruct>

you now have two references to the same structure object. Neither reference
is the thing itself - they are just both names you can use to get to the
thing itself. Here's a description of stack and heap allocation in Python,
which is for our purposes similar enough to how things work in CF:

http://mail.python.org/pipermail/tutor/2001-July/007318.html

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Software provides the highest caliber vendor-authorized 
instruction at our training centers in Washington DC, Atlanta, 
Chicago, Baltimore, Northern Virginia, or on-site at your location. 
Visit http://training.figleaf.com/ for more information!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207888
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to