Jeff,
On Tue, Jul 25, 2017 at 8:53 AM, Jeffrey Kain via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> You can start in, say, method A with a line like
>
>   $obj:=[Table]objectField
>
> ... and pass $obj through any number of methods as a local variable, or a
> pointer, or a process object variable. Any changes anywhere down the line
> will be made in [Table]objectField, since that's the only "real" object --
> everything else is just a reference.
>
​It would never occur to me to do that but it's an interesting case to
think about. ​But by involving an object field I would think you'd be
ultimately limited by where the record was loaded. If we make the
assignment in Process A, and then pass the object to Process B I would
expect Process B to begin working with a copy of $obj, not the actual
object. Have you tested that changes made in Process B are reflected in
[Table]objectField?

And let's say we close process A but not B. I don't think the object just
goes away.

I may have to make a db and try these things out tonight. This is pretty
interesting the more I think about it.

Regarding not being a fan of the memory heap, and recalling I'm not the
most informed computer architecture guy, what are other approaches to
managing objects in memory?

Since I do a lot of work with parsing chunks of text into arrays, for
instance, it seems like a benefit to be passing references to an object
rather than the object. I have had the impression that given:

$chunk1:=Parse_some_text

Parse_text_toArrays($chunk1;->array)

Parse_text_toArrays
​ creates a separate copy of $chunk1 whereas​

$chunk1:=Parse_some_text

Parse_text_toArrays(->$chunk1;->array)

Parse_text_toArray works with the original $chunk1 directly via
dereferencing the pointer. If I understand your point in both cases I'm
passing a reference to the object. Presumably in the first case I would
make a copy of the object as soon as I do anything to alter it. Do I have
this right?

-- 
Kirk Brooks
San Francisco, CA
=======================

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to