actually, I beg to differ on this.

inter-process variables, yes, I suppose you can work around them.

but I have not yet found a good way to write worker code without using process 
variables.

true, you can run a worker recursively, passing local/contextual information as 
arguments packed as an object,
but what about large data or more specifically, arrays?

of course you can insert the array in an object too,
but as I understand, an object passed to a worker is copied, not referenced,
so I would imagine there is going to be a huge over-head
when, for example, a worker is progressively building an array in the 
background.

a process variable, to me, seems to be the ideal data buffer for such tasks.

given that a preemptive worker has no UI,
the variable is insulated from other processes,
unlike classic process variables that are bound to a form object.

but then, any process can run a method in that worker's context,
so the real gem of preemptive coding in 4D could well be in
how the methods are logically organised.

perhaps one can ASSERT that a method can only be called from a certain worker.
so the standard signature could be something like

MyWorker (Current process name;object{;object}...)

so that the worker always know who called it.

finally, in development,
a worker can be aborted (and the process variables destroyed),
but a caller might keep calling it in a loop and thus create a new instance,
so it might be useful to protect the recursive code in the callee method that 
uses process variables.

> 2016/09/15 8:44、David Adams <dpad...@gmail.com> のメール:
>
> 1) Ignore process and IP variables. Period. (In fact, I'd recommend this no
> matter what - mingling variables this way is kind of a crappy way to code
> anyway.)



宮古 啓介
セールス・エンジニア

株式会社フォーディー・ジャパン
〒150-0043
東京都渋谷区道玄坂1-10-2 渋谷THビル6F
Tel: 03-6427-8441
Fax: 03-6427-8449

keisuke.miy...@4d.com
www.4D.com/JP

**********************************************************************
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