Hacker News new | past | comments | ask | show | jobs | submit login

Very nice. I may use this the next time I blog about JavaScript.

One inconvenience. I entered "while (1) {}" and the page locked up and needed to be reloaded. An infinite loop could easily happen unintentionally, and it's not user-friendly to hang, especially when the goal is an Alan Kay style educational/interactive system. It would be nice to have a "stop" button so the user could continue editing, rather than losing the page. Unfortunately I don't see any way to do this within existing browsers.




I've watched people use "learn to code" websites with this sort of auto-running javascript trip up on infinite loops and get frustrated as the page freezes. A sure-fire way for a user to accidentally do this is for them to make a `while(true)` loop first before trying to add a `if(x) break;` statement inside of it, or when they're trying to make a recursive function and mess it up.

The problem is that the page is just having the browser execute the javascript directly. Javascript in the browser doesn't have ways to directly debug itself or enforce resource limits. It would be nice if there was a javascript interpreter (yes, in javascript) that could enforce step and resource limits and have debugging support that pages could interactively embed.


The khan academy code editor is nice like that and avoids infinite loops.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: