Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy an Object
Message
From
16/07/2006 13:29:25
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01136724
Message ID:
01136800
Views:
12
>Thomas,
>
>Why do you need a copy of the parameter object? You should be able to just keep passing the same one around. If you go copying and forking different versions of the parameter object around to different methods/functions I'd think it'd get hard to know what version of the parameter object is at any point. If the parameter object is not being written to by the destinations then there isn't much reason to not just use the one instance.

About the only thing I can see a need for copying the object is to preserve the original as a backup before sending it into UDF/Methods that might alter the original.

Other than than I suspect someone's gone overboard with pulling fields into an objects' properties and wants to copy it like scatter/gather.

>
>It's not that hard to write a clone/serialize/deserialize method in a class hierarchy provided that shallow copy is all you need.
>
>>There is one area I'ld like to have a native clone-method or function: if I have to use standadized parameter objects. A simple "shallow copy" functionality like you described with amembers() should be enough there - the deep copy functionality (cloning of referenced objects) should not be needed.
>>
>>But if you ever had the "pleasure" of having to write inside a framework having a "halfgod"-like parameter object (and yes, they had god objects as well <g>) as part of the interface you'ld probably feel the need as well.
Previous
Reply
Map
View

Click here to load this message in the networking platform