Recursion limit

prothero at earthlearningsolutions.org prothero at earthlearningsolutions.org
Tue Jul 4 11:29:24 EDT 2017


Why not put this in a "repeat forever" loop and test for iStopp=0, then exit repeat when true?

Put 1 into iStopp
Repeat while iStopp<>0
  Intersect testing code that puts 0 into iStopp, appropriately
  If iStopp=0 then
      Exit repeat
  End if
End repeat

Of course, there is probably some reason, but this is the way I would probably approach this.

Best,
Bill P

William Prothero
http://es.earthednet.org

> On Jul 4, 2017, at 12:59 AM, Richmond Mathewson via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Well I'm not doing infinite recursion:
> 
> MouseUp Script inside button "GO2" sending "mouseDown" to button "GO2"
> 
> onmouseUp
> 
> put0 intoSTOPP
> 
> ifintersect(img "ball1",img "stop") then
> 
> put1 intoSTOPP
> 
> endif
> 
> ifintersect(img "ball2",img "stop") then
> 
> put1 intoSTOPP
> 
> endif
> 
> ifintersect(img "ball3",img "stop") then
> 
> put1 intoSTOPP
> 
> endif
> 
> ifintersect(img "ball4",img "stop") then
> 
> put1 intoSTOPP
> 
> endif
> 
> ifSTOPP = 0 then
> 
> send"mouseDown" tobtn "GO2"
> 
> endif
> 
> endmouseUp
> 
> Richmond.
> 
> 
> 
>> On 7/4/17 10:50 am, Mark Waddingham via use-livecode wrote:
>>> On 2017-07-04 09:28, Richmond Mathewson via use-livecode wrote:
>>> BUT . . .
>>> 
>>> How can one know how high one can set the recursionLimit before smoke, sparks
>>> and flames are going to start leaping out of the back of the computer?
>>> 
>>> Or, less frivolously; how can one determine the upper limit on the
>>> recursionLimit before the
>>> stack "hangs" (presumably that means the thing will lock solid) ?
>> 
>> The recursionLimit is limited by the size of the C stack (in bytes). I think on Mac that is 8 Mb by default (although I think you can configure it using ulimit or some similar command-line trickery).
>> 
>> One thing to check that you aren't (by accident) doing infinite recursion. i.e. A variant of:
>> 
>>  on myFunction
>>    myFunction
>>  end myFunction
>> 
>> Obviously *that* is trivially noticeable as being infinite. However, it is quite easy to write stuff like this when its buried in lots of lines of code (hence why LiveCode has a 'recursionLimit').
>> 
>> My general advice would be:
>> 
>>  1) Run your routine
>> 
>>  2) If it hits the recursionLimit double the recursionLimit property.
>> 
>>  3) Goto (1)
>> 
>> If you reach 8Mb limit then put some logging into your code to make sure it *does* actually need to recurse that deeply.
>> 
>> Warmest Regards,
>> 
>> Mark.
>> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list