If a method creates an object ($no:=new object), the object is destroyed when 
the method ends?
and
if a method creates a new shared object ($nso:=new shared object), the object 
continues to exist after the method ends, but the reference to it is lost?  
Does 4D know to clear the object in this case?

Keith - CDI

> On Oct 20, 2018, at 11:28 PM, Keisuke Miyako via 4D_Tech 
> <[email protected]> wrote:
> 
> I prefer to explain it this way:
> 
> when you pass a New object or New collection  to a method (subroutine),
> that object or collection is shared between the 2 methods, caller and callee,
> because they are running in the same process.
> 
> if you execute $1.foo:="bar" in the callee,
> the object from the caller is also updated,
> because they are in fact referenced to the same object.
> 
> if you do the same across processes,
> i.e. pass a New object or New collection to New process, CALL WORKER or CALL 
> FORM,
> the object or collection is not shared between the 2 methods, caller and 
> callee,
> because they are not running in the same process.
> 
> the best way to share an object or collection between processes is to pass a 
> shared object or shared collection as a parameter.
> there is no need to use Storage, there is no need to use interprocess 
> variables.
> you just create a shared object or shared collection, and pass it as an 
> argument to another process or worker.
> the received object is not a copy, it is a shared reference to the same 
> shared object.
> 
> Storage is not mandatory, if you always pass shared objects using parameters,
> which is good practice, according the law of Demeter.
> 
> https://en.wikipedia.org/wiki/Law_of_Demeter
> 
> the reason why Storage often pops up in the context of interprocess variables,
> is because we recognise that in many applications, interprocess variables are 
> casually references all over the place.
> it is provided as a last resort, a global shared object to which you can 
> attach all your shared objects
> so that you can access them from anywhere in your code, without using 
> parameters.
> 
>> 2018/10/21 13:11、lists via 4D_Tech <[email protected]>のメール:
>> 
>> In order to share an object between processes without using an interprocess 
>> variable, you must use the "Storage" container/catalog.
> 
> 
> 
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to