Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You have to reload the page each time if your edit was wrong.

You'd have to do that anyway. If code is wrong, it corrupts state. Unless you're saying you want it to keep track of diffs of the heap, which might be interesting. But how would it handle, say, a socketIO connection that a bad edit terminates? There'd be no way to rewind that.

Maybe it doesn't matter for most work, since most work doesn't interact with persistent objects (sockets, file handles...)



> Unless you're saying you want it to keep track of diffs of the heap

Yup, that's exactly what I'm saying. Keep track of (store) the full browser state before entering a function, and when you rewind restore that exactly.

Local I/O is no problem, remote I/O will simply be restarted. Or it will error. It doesn't have to be perfect to be useful.

Mozilla actually is working on such a tool: http://rr-project.org/ (for gdb i.e native) and https://developer.mozilla.org/en-US/docs/Mozilla/Projects/We... (for browser).

It would be awesome if they fully integrated those tools into the built in debugger.


I've worked with this model a bit (I made a tool to watch the file system and automatically sync changed code into Chrome - plug: https://github.com/aidos/chromesync).

It turns out that corrupting state isn't always such a big issue. A load of what you end up doing in js is event handlers, and by being able to replace those in realtime you can save a load of dev time.

(As ever, when this conversation comes up I complain bitterly about how Chrome only allows a single websocket connection to the debugger so you need to do weird ws proxy stuff to use live reloading and devtools at the same time....)

I also use a similar thing to have live reloading in iPython for my backend work. Honestly, I'm not sure how I ever lived without being able to swap out the code in my functions without having to rebuild all the state. It's not without issue, and you _can_ corrupt your internal state, but in practice it's fine 98% of the time.




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

Search: