Re: Script locals in library stack script
On 2/10/17 2:22 PM, J. Landman Gay via use-livecode wrote: I have set the LC preference to preserve variables. In the past I have rarely seen a script local lose its value, and never if there has been no script compile. I don't know exactly when it started but I was in 8.1.3 rc 1 when I noticed it. In case anyone has been losing sleep over this, it was indeed me. Two weeks later while revising my scripts I found the culprit line, sandwiched between two large blocks of commented-out code, lurking with its head down and its eyes closed. But there was a snicker on its face. I hit it over the head, put it in a gunny sack, and threw it in the river. Our river is frozen right now so I hope it hurt. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
I mised that this was on a web server. I should pay more attention. Bob S > On Feb 10, 2017, at 20:03 , J. Landman Gay via use-livecode > wrote: > > I know, that's why I didn't report it. I scoured the script looking for a > difference but I couldn't find anything, the two queries were executed by the > same handler. I looked for anything that would empty the variable and that > wasn't there either. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
I know, that's why I didn't report it. I scoured the script looking for a difference but I couldn't find anything, the two queries were executed by the same handler. I looked for anything that would empty the variable and that wasn't there either. My current theory is creeping stack corruption. The stack ran with only this one oddity, but when I tried to reload it from disk later it was reported as corrupted and wouldn't open. I had to open it in BBEdit and use a days-old backup in LC to paste in all the changes. Apparently it had corrupted several days before, but because I'd left the Mac on with the stack open I didn't know. I've sent the working stack and the corrupted one to bugzilla though I don't know if the team can make anything of it. The missing variable appeared in LC 8.1.2 so I switched over to LC 9 to see if that helped. That's when the stack gave up. I think I'll stay away from 9 until it's out of dp, but there's something going on with LC 8 too in some unique circumstance. I haven't had any trouble with 8 before now. On 2/10/17 8:47 PM, Bob Sneidar via use-livecode wrote: I don't mean to oversimplify, but when customers call complaing that only one of several scan to SMB registrations is failing, I have to get them to see that if all the others are not failing ever, it cannot be a problem with the copier. If only one script local is getting reset, then it cannot be that LC is resetting script locals because they would ALL reset, not just one. It may be possible to set a breakpoint on the script local to trigger when it becomes empty. Bob S On Feb 10, 2017, at 12:22 , J. Landman Gay via use-livecode wrote: The extremely odd thing was that the script had three script locals, and only one of them lost its value. The other two were fine. It was impossible to track down. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
I don't mean to oversimplify, but when customers call complaing that only one of several scan to SMB registrations is failing, I have to get them to see that if all the others are not failing ever, it cannot be a problem with the copier. If only one script local is getting reset, then it cannot be that LC is resetting script locals because they would ALL reset, not just one. It may be possible to set a breakpoint on the script local to trigger when it becomes empty. Bob S > On Feb 10, 2017, at 12:22 , J. Landman Gay via use-livecode > wrote: > > The extremely odd thing was that the script had three script locals, and only > one of them lost its value. The other two were fine. It was impossible to > track down. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
—>There used to be a way to do that but I can't remember how, or else I forgot it on purpose because it didn't work. I think this is how you would do that… in IDE, debug menu->Add variable watch select the library stack and sVarA in the pop up. What I haven’t tested is the Condition. Maybe "is empty" You could also add "if sVarA is empty then breakpoint” at interesting points in the script. Bob Hall ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
On 2/10/17 5:56 AM, Bob Hall via use-livecode wrote: I’ve been wondering this myself. I’m going to try to create a recipe but it looks like the TTL of script local variables is different than what I thought I knew it to be. I “think” I started see this behavior about 8.1.0-ish timeframe but not sure. In the past few months I started to put everything into properties as I found that my understanding of how script local variables behaved was different then how they do. I have set the LC preference to preserve variables. In the past I have rarely seen a script local lose its value, and never if there has been no script compile. I don't know exactly when it started but I was in 8.1.3 rc 1 when I noticed it. I spent two days trying to fix the problem, eventually gave up and worked around it. The extremely odd thing was that the script had three script locals, and only one of them lost its value. The other two were fine. It was impossible to track down. Here is what I was doing: Stack Main has a substack "InternetLib" that contains all handlers that deal with server connections. It is put in use when Main opens. InternetLib handles server queries and returns the retrieved data. That all works fine. It also has a "setter" handler that can be used to store data in a script local variable in its own script, and a "getter" handler to return data from the script local. What happened: 1. Stack Main calls InternetLib to do a query. 2. Stack Main manipulates the returned data, parses out what it needs, and calls the "setter" handler to store it in the script local "sVarA" in InternetLib. 3. Immediately after the handler ends, Stack Main calls InternetLib to do a second query. 4. Stack Main uses the returned data and calls the "setter" handler to store the value in InternetLib script local "sVarB". 5. Later, stack Main tries to retrieve a value from sVarA. sVarA is empty. 6. Retrieving data from sVarB is always available. The third script local, sVarC, always retains its value. It is not involved with the above process, it is set earlier when Main is opened. When tracing through the handlers, it appears that sVarA loses its value some time between the first query and the second. What I need to do is find a way to track sVarA to see when it changes. There used to be a way to do that but I can't remember how, or else I forgot it on purpose because it didn't work. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
Bob Hall wrote: > So I guess I need to understand what is the TTL definition of a > script local variable? In the engine, script-local variables will retain their values throughout the session. If a script is edited, however, by default the recompilation of the script causes the script-local variables to be cleared. This default can be overridden with the preserveVariables property. False by default, when set to true script-local variables will retain their values between compilations of the script they appear in. I had previously thought that the preserveVariables was a global property, which would mean its value is preserved throughout the session, and that the "Variable Preservation" checkbox in the "Script Editor" section of Prefs reflected that value. However, the Dictionary does not specify that the preserveVariables is a global property, and there appears to be no relationship between the seemingly-related Prefs checkbox and this property - recipe: 1. In the Message Box, run: put the preserveVariables 2. In the MB, set the preserveVariables to the opposite 3. Open the Prefs window, note the checkbox 4. Close the Prefs window 5. In the MB, set the preserveVariables to its opposite 6. Open the Prefs window, not that the checkbox retains the true/false state seen before, even though the property itself has changed. The Dictionary does say: The preserveVariables property is provided as a background compatibility aid. It should not, in general, be used in user scripts as the IDE automatically handles preservation of variables via the Variable Preservation option in the preferences and Script Editor Script menu. So while I once thought I'd understood both the property and the seemingly-related Prefs setting, apparently I do not. Guidance from the IDE team would be welcome here. -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
This might explain the bizarre bug I'm experiencing with one of Monte's externals. I manage the calls to the various routines for the external from a library stack. Periodically, I end up somewhere in the code that I shouldn't be able to get to because of the values of various variables, and the only way I could get there would be if the values were somehow wiped. Hm. Maybe it's not my code. Time to go sleuthing... On Fri, Feb 10, 2017 at 6:56 AM, Bob Hall via use-livecode < use-livecode@lists.runrev.com> wrote: > I’ve been wondering this myself. I’m going to try to create a recipe but > it looks like the TTL of script local variables is different than what I > thought I knew it to be. I “think” I started see this behavior about > 8.1.0-ish timeframe but not sure. > > In the past few months I started to put everything into properties as I > found that my understanding of how script local variables behaved was > different then how they do. I had chalked it up to getting old and just > forgetting how things work. > > So I guess I need to understand what is the TTL definition of a script > local variable? I was under the impression that if I have setters/getters > for the variables and set their value, as long as that Script remains in > memory, the script local variable retains it’s value. I do not see that for > sure if I set the script local var in the libraryStack message in 8.1.2 or > 8.1.3. > > Curious if you’ve figured out anything about this since the original note. > > Bob Hall > > > > > Is this something others have seen? LC 8.1.3 rc 1. > > > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, "This is good." ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
I’ve been wondering this myself. I’m going to try to create a recipe but it looks like the TTL of script local variables is different than what I thought I knew it to be. I “think” I started see this behavior about 8.1.0-ish timeframe but not sure. In the past few months I started to put everything into properties as I found that my understanding of how script local variables behaved was different then how they do. I had chalked it up to getting old and just forgetting how things work. So I guess I need to understand what is the TTL definition of a script local variable? I was under the impression that if I have setters/getters for the variables and set their value, as long as that Script remains in memory, the script local variable retains it’s value. I do not see that for sure if I set the script local var in the libraryStack message in 8.1.2 or 8.1.3. Curious if you’ve figured out anything about this since the original note. Bob Hall > > Is this something others have seen? LC 8.1.3 rc 1. > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
On 2/8/17 4:52 PM, Monte Goulding via use-livecode wrote: On 9 Feb 2017, at 9:32 am, J. Landman Gay via use-livecode wrote: I have a splash stack that opens a data stack from a server. The data stack has a substack which is used as a library with "start using". The handlers in the library work okay. Some of them store data in script local variables in the library script. The script locals do not retain their values, they are almost always empty when the library tries to access them later. Is this something others have seen? LC 8.1.3 rc 1. I’m guessing you don’t mean in a separate request on the server. I’m not aware of anything special about the way server does stuff with variables so someone would need to chase this down based on a bug report I think. Right, after downloading the data stack, for this stuff it's all local messaging. I'll try to track it down before submitting a bug, I just wondered if this was a known thing. I'm seeing other problems that indicate the message path isn't what I expect. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Script locals in library stack script
> On 9 Feb 2017, at 9:32 am, J. Landman Gay via use-livecode > wrote: > > I have a splash stack that opens a data stack from a server. The data stack > has a substack which is used as a library with "start using". > > The handlers in the library work okay. Some of them store data in script > local variables in the library script. The script locals do not retain their > values, they are almost always empty when the library tries to access them > later. > > Is this something others have seen? LC 8.1.3 rc 1. I’m guessing you don’t mean in a separate request on the server. I’m not aware of anything special about the way server does stuff with variables so someone would need to chase this down based on a bug report I think. Cheers Monte ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode