Is #L8 truly global?
Doug Easterbrook
doug at artsman.com
Wed Nov 8 21:37:07 UTC 2023
#L8 .. I’m going to go truly wild now. I thought there was only #L1 .. and to find out the are numbered #1 to #8
My understanding is this (from working with Michael M. on our web servers eons ago) .
You have these hash variables available to you per startup_task, and per remote_task instance
so if you close the startup_task that created/defined #L8, its data is gone. but it is available to be used by other libraries when it is opened.
same with creating a remote_task instance .. you got a set of hash variables and file class variables unique to that startup task that are not visible to the other remote_task.
if you are thinking of using these to pass around data to various libraries as super globals, I might suggest not to (it kind of breaks encapsulation)..
instead, I’d pass a parameter (like the example in this statement - #S1)…. if you want libraries to know about each other..
but I’d probably pass in some item references that point back to common objects or just the task itself
eg
Open library (Do not close others,Enable conversion by runtime,Convert without user prompts) [theatreLibraryPathName] (#S1)
becomes
Open library (Do not close others,Enable conversion by runtime,Convert without user prompts) [theatreLibraryPathName] ($ctask.$ref,objectRef,etc)
and then, if you want the data in your second libary, you do callbacks to get it, or explicitly clone the data in the second library.
i.e in the library you opened, I’d do things like
do refToMainLibrary.$getL8 returns localList
in other words, don’t depend on something like these being global. copy the data. it will reduce points of failure and expectations that data exists. because the place you talk to the other library is in one spot.
just my thoughts.
Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978
> On Nov 8, 2023, at 1:18 PM, Mike Matthews - Omnis via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
> Hello All,
>
> In olden days, we only had these # hash type of variables. We were told they were global to the instance of Omnis.
>
> Then came multi libraries, task variables, instance variables, and so we were encouraged to forget #L1, #S1 and so on. I still remember #G1, but they has sadly died, while the others stubbornly refuse to die! Hooray.
>
> If you define #L8 in library A, which opens library B, add lines to it, all is good. But if you close Library A, then #L8 disappears.
>
> So my questions is this : Are the Hash vars tied to the library that made them, ie, not Omnis Global, or something else that is pushing us to forget these wonderful variables? I have two demo libraries as well.
>
> Thanks
>
> Mike Matthews
>
> Lineal Software Solutions
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list