Recursion error message for non recursive code

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Recursion error message for non recursive code

Ronaldo
It is not easy to debug a recursive code when you get a recursion error: there is no indication of which recursion is the culprit. Things get worst when a non-recursive code generates a recursion error message like that:

echo([for(b=0; b!=1; b=0) b]);

That is an infinite loop, I know, but couldn't we have a better error message?

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursion error message for non recursive code

nophead
I get:

ERROR: Recursion detected calling for loop '' in file echo.scad, line 1


from a recent build of master.


The error messages get better day by day due to the great work of Michael Fry.


On Fri, 18 Jan 2019 at 15:35, Ronaldo Persiano <[hidden email]> wrote:
It is not easy to debug a recursive code when you get a recursion error: there is no indication of which recursion is the culprit. Things get worst when a non-recursive code generates a recursion error message like that:

echo([for(b=0; b!=1; b=0) b]);

That is an infinite loop, I know, but couldn't we have a better error message?
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursion error message for non recursive code

nophead
Sorry that should be Michael Frey

On Fri, 18 Jan 2019 at 18:05, nop head <[hidden email]> wrote:
I get:

ERROR: Recursion detected calling for loop '' in file echo.scad, line 1


from a recent build of master.


The error messages get better day by day due to the great work of Michael Fry.


On Fri, 18 Jan 2019 at 15:35, Ronaldo Persiano <[hidden email]> wrote:
It is not easy to debug a recursive code when you get a recursion error: there is no indication of which recursion is the culprit. Things get worst when a non-recursive code generates a recursion error message like that:

echo([for(b=0; b!=1; b=0) b]);

That is an infinite loop, I know, but couldn't we have a better error message?
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursion error message for non recursive code

Ronaldo
In reply to this post by nophead
I get:

ERROR: Recursion detected calling for loop '' in file echo.scad, line 1


from a recent build of master.


Well, that is a lot better than what I got with version 2018.01.06 (git 3473eb1) :

ERROR: Recursion detected calling for loop ''


although the recursion mention is misleading yet.


I need to update my OpenSCAD version...


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursion error message for non recursive code

nophead
Yes the real error is stack overflow, which is normally due to recursion but in this case the ever growing list. Not sure how you would distinguish that.

Also why is there a quote between loop and in?

On Fri, 18 Jan 2019 at 18:19, Ronaldo Persiano <[hidden email]> wrote:
I get:

ERROR: Recursion detected calling for loop '' in file echo.scad, line 1


from a recent build of master.


Well, that is a lot better than what I got with version 2018.01.06 (git 3473eb1) :

ERROR: Recursion detected calling for loop ''


although the recursion mention is misleading yet.


I need to update my OpenSCAD version...

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursion error message for non recursive code

MichaelPFrey
In reply to this post by Ronaldo
On 18.01.19 16:34, Ronaldo Persiano wrote:
It is not easy to debug a recursive code when you get a recursion error: there is no indication of which recursion is the culprit.

Are you on a release or on a development version?

The development version should output filename and line number.

A stack trace is in development:

https://github.com/openscad/openscad/pull/2645

(It works fine, so the question is not how to get it working, but to get it cleanly implemented)

Things get worst when a non-recursive code generates a recursion error message like that:

echo([for(b=0; b!=1; b=0) b]);

That is an infinite loop, I know, but couldn't we have a better error message?

I will look into that once the trace PR has gone trough.

Having multiple PRs open in the same proximity has a tendency to create merge conflicts and failing tests.


With kind regards,

Michael Frey


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Recursion error message for non recursive code

Ronaldo
I have installed the last snapshot development version. Wow! I take my hat off to the nice job done with the error messages! Now it is a lot easy to debug codes.

I understand the stack overflow may be what fired the recursion message for an infinite loop. I hope you find a way to distinguish the two cases.

On 18.01.19 16:34, Ronaldo Persiano wrote:
It is not easy to debug a recursive code when you get a recursion error: there is no indication of which recursion is the culprit.

Are you on a release or on a development version?

The development version should output filename and line number.

A stack trace is in development:

https://github.com/openscad/openscad/pull/2645

(It works fine, so the question is not how to get it working, but to get it cleanly implemented)

Things get worst when a non-recursive code generates a recursion error message like that:

echo([for(b=0; b!=1; b=0) b]);

That is an infinite loop, I know, but couldn't we have a better error message?

I will look into that once the trace PR has gone trough.

Having multiple PRs open in the same proximity has a tendency to create merge conflicts and failing tests.


With kind regards,

Michael Frey

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org