I think that’s about right, except I think you’d have to instantiate it at the
same time it was declared. Maybe something like this:
ARRAY TEXT($atTemp;2)
$atTemp{1}:=“value 1”
$atTemp{2}:=“value 2”
ARRAY TEXT(><MyArray;$atTemp)
I use “><“ here instead of “<>” to let 4D know it is a static variable, for
lack of a better idea. But whatever the mechanism, when 4D sees that it knows
it needs to declare and immediately populate the static array from the local
array. There is no need to declare the size of the array since that will come
from the local array anyway.
Actually, since _all_ static variables of any type would have to be given a
value at the same time it was declared, maybe we only need one command:
STATIC(Name of Static Variable;Variable or Value To Populate With)
In the above example, it would become STATIC(><MyArray;$atTemp).
But it could also be: STATIC(><Pi;3.1415), etc. 4D can figure out the type of
the static variable it is creating based on the type of the variable/value in
the second parameter.
In any case, this type of variable would solve some of the issues where we
currently use IP variables as a caching mechanism, but only in cases where
those values can be set up during launch and never change again. For situations
where we cache values that can change, even if seldom, this won’t work.
For those situations, I think I’ll test having a “Cache” table where I can
cache those sorts of things in it. Then I’ll just grab it from a record
whenever needed. I think we can now ask 4D to keep certain tables in the cache
all the time, so this would be one that would need to always stay there. At
that point, it is basically a memory transfer which should be fast.
Of course, this doesn’t help if/when we end up with preemptive processes on the
client someday….
--
Cannon Smith
Synergy Farm Solutions Inc.
Hill Spring, AB Canada
403-626-3236
<[email protected]>
<www.synergyfarmsolutions.com>
> On Nov 4, 2016, at 9:51 AM, Chip Scheide <[email protected]> wrote:
>
> create a local array/object
> declare the static array
> Copy Array (local;static)
>
> haven't worked with objects - but same Idea I assume
>
**********************************************************************
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:[email protected]
**********************************************************************