Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loops #1

Open
viebel opened this issue Oct 18, 2016 · 4 comments
Open

Infinite loops #1

viebel opened this issue Oct 18, 2016 · 4 comments

Comments

@viebel
Copy link

viebel commented Oct 18, 2016

I’m trying to understand your eval-soup in cljs. Especially, the way you prevent infinite loop

Does it catch all the cases?
For instance (print (map inc (range 10)))

@oakes
Copy link
Owner

oakes commented Oct 18, 2016

It won't prevent infinite loops that consume the stack. It only prevents ones that use recur underneath.

@viebel
Copy link
Author

viebel commented Oct 19, 2016

I see.
What are interesting use cases of macros/functions that use recur
underneath?

On Wed, 19 Oct 2016 at 00:58 Zach Oakes notifications@github.com wrote:

It won't prevent infinite loops that consume the stack. It only prevents
ones that use recur underneath.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA6VPkmPyaQJsDa0XE7L0R_7bfdJmPr1ks5q1UEUgaJpZM4KZ6QN
.

@oakes
Copy link
Owner

oakes commented Oct 19, 2016

It basically just covers loop and macros that use it, like while and doseq. I would love to cover infinite lazy seqs as well...I was hoping those would eventually lead to an out of memory exception or something.

@viebel
Copy link
Author

viebel commented Oct 31, 2016

I found an interesting way to prevent infinite loop by hacking the cljs compiler and inserting guard() calls before each if and recur statement. You can take a look here https://github.com/viebel/klipse/pull/131/files.

I'd be happy to get your thoughts on this idea...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants