Recursion limit

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Recursion limit

Mark Waddingham via use-livecode
"the handler: revIDEStackNameIsIDEStack
has reached the recursion limit of: 400000.
Execution will be terminated to prevent hang"

OK, OK, hanging is a type of execution.

This is "all very charming" but I want the script to
go on "crawling up its own bottom" considerably
longer than that . . .

Does anyone know how to circumvent
this limit?

Richmond.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
Hi Richmond,

I'm wondering if the recursion limit is limited  within the IDE and you are
allowed to recurse to your hearts content in a standalone.

Well that's what I would surmise from the error message - IDEstack.

I could be wrong though.

Regards Lagi

On 4 July 2017 at 08:05, Richmond Mathewson via use-livecode <
[hidden email]> wrote:

> "the handler: revIDEStackNameIsIDEStack
> has reached the recursion limit of: 400000.
> Execution will be terminated to prevent hang"
>
> OK, OK, hanging is a type of execution.
>
> This is "all very charming" but I want the script to
> go on "crawling up its own bottom" considerably
> longer than that . . .
>
> Does anyone know how to circumvent
> this limit?
>
> Richmond.
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode
On 2017-07-04 09:05, Richmond Mathewson via use-livecode wrote:

> "the handler: revIDEStackNameIsIDEStack
> has reached the recursion limit of: 400000.
> Execution will be terminated to prevent hang"
>
> OK, OK, hanging is a type of execution.
>
> This is "all very charming" but I want the script to
> go on "crawling up its own bottom" considerably
> longer than that . . .
>
> Does anyone know how to circumvent
> this limit?

You can't circumvent but you can configure the limit - take a look at
'the recursionLimit' property.

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode


On 7/4/17 10:11 am, Lagi Pittas via use-livecode wrote:
> Hi Richmond,
>
> I'm wondering if the recursion limit is limited  within the IDE and you are
> allowed to recurse to your hearts content in a standalone.

Possibly . . . I don't know how to 'recurse' but I do know how to 'curse
to my heart's discontent'.

I am trying to code a virtual robot mouse which will find its way
through a maze using intersect,

and will find another, non-recursive way to do things (this is not a
problem as I was messing around with recursion
because of another problem I had with the thing) . . .

However, as this is the only time I have come up against the recursion
limit I was wondering
whether there is a way to circumvent it, in the IDE.

Richmond.

>
> Well that's what I would surmise from the error message - IDEstack.
>
> I could be wrong though.
>
> Regards Lagi
>
> On 4 July 2017 at 08:05, Richmond Mathewson via use-livecode <
> [hidden email]> wrote:
>
>> "the handler: revIDEStackNameIsIDEStack
>> has reached the recursion limit of: 400000.
>> Execution will be terminated to prevent hang"
>>
>> OK, OK, hanging is a type of execution.
>>
>> This is "all very charming" but I want the script to
>> go on "crawling up its own bottom" considerably
>> longer than that . . .
>>
>> Does anyone know how to circumvent
>> this limit?
>>
>> Richmond.
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode
Aha!

I'm listening to "the man" himself.

Thank you very much indeed.

I do hope you still find time to keep practicing the piano as a programmer
who also plays the piano does an awful lot to dispell the geek myth.

Best, Richmond.

On 7/4/17 10:20 am, Mark Waddingham via use-livecode wrote:

> On 2017-07-04 09:05, Richmond Mathewson via use-livecode wrote:
>> "the handler: revIDEStackNameIsIDEStack
>> has reached the recursion limit of: 400000.
>> Execution will be terminated to prevent hang"
>>
>> OK, OK, hanging is a type of execution.
>>
>> This is "all very charming" but I want the script to
>> go on "crawling up its own bottom" considerably
>> longer than that . . .
>>
>> Does anyone know how to circumvent
>> this limit?
>
> You can't circumvent but you can configure the limit - take a look at
> 'the recursionLimit' property.
>
> Warmest Regards,
>
> Mark.
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode
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) ?

Richmond.

On 7/4/17 10:20 am, Mark Waddingham via use-livecode wrote:

> On 2017-07-04 09:05, Richmond Mathewson via use-livecode wrote:
>> "the handler: revIDEStackNameIsIDEStack
>> has reached the recursion limit of: 400000.
>> Execution will be terminated to prevent hang"
>>
>> OK, OK, hanging is a type of execution.
>>
>> This is "all very charming" but I want the script to
>> go on "crawling up its own bottom" considerably
>> longer than that . . .
>>
>> Does anyone know how to circumvent
>> this limit?
>
> You can't circumvent but you can configure the limit - take a look at
> 'the recursionLimit' property.
>
> Warmest Regards,
>
> Mark.
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
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.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
If the mouseDown handler calls the mouseUp again, then it's a type of
recursion. You can avoid that by sending the mouseDown after the mouseUp
has ended :

if STOPP = 0 then
send "mouseDown"  to btn "GO2" in 0
end if

(I wonder why your scripts lose all the spaces when they pass through the
list?)

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

Usually there's no fire. LC just shuts down suddenly and you lose all your
work. After that, you set the computer on fire yourself. Ergo, the warning
and intercept.



On July 4, 2017 3:01:37 AM Richmond Mathewson via use-livecode
<[hidden email]> 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.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode

If a maze has modest dimensions such as 50 x 100 squares, LiveCode
should be able to handle a recursive solution with no issues.

If a maze has very large dimensions or irregular paths to test, I would
play it safe by using pseudo recursion or other techniques. That way you
"burn rubber" on the maze, but no smoke from your computer or puff of
smoke where LiveCode was a moment ago. :)

 From your code I'm not sure whether you're primarily using recursion to
solve the maze. If not, try Jacque's tip!

Best wishes,

Curry Kenworthy

Custom Software Development
http://curryk.com/consulting/

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion limit

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode
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 <[hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...