ic
ic copied to clipboard
Is there a function to restart method (thread) frame after hot code replacement and restart replacement? This is too important for debugging
Is there a function to restart method (thread) frame after hot code replacement and restart replacement? This is too important for debugging?
like java debug with vsode:

Hello acodervic,
Unfortunately, there are no hot code reload yet in the interpreter. However, I don't think we are so far of this feature. Like java, he interpreter generate bytecode and works by frame, and pry is already able to execute code in the context of a current frame. I don't know if I could get something by monkey patching the interpreter ?
It would be a nice feature request at https://github.com/crystal-lang/crystal/issues though.
Hello acodervic,
Unfortunately, there are no hot code reload yet in the interpreter. However, I don't think we are so far of this feature. Like java, he interpreter generate bytecode and works by frame, and pry is already able to execute code in the context of a current frame. I don't know if I could get something by monkey patching the interpreter ?
It would be a nice feature request at https://github.com/crystal-lang/crystal/issues though.
ok , We all look forward to this day~
clearly^^ :)
clearly^^ :)
I requested this feature as if they didn't really care.
Hello acodervic,
Unfortunately, there are no hot code reload yet in the interpreter. However, I don't think we are so far of this feature. Like java, he interpreter generate bytecode and works by frame, and pry is already able to execute code in the context of a current frame. I don't know if I could get something by monkey patching the interpreter ?
It would be a nice feature request at https://github.com/crystal-lang/crystal/issues though.
I ask @asterite this feature here too.
Probably this feature not available too soon.
Also what I did is different from hot code reload. You won't be able to put debugger, stop the program, do changes and reload.
I tried to mokey patch the interpreter for this feature, I managed to get some interesting things, but nothing really functional. However, I started to work on just be able to restart the frame, and I thing this work well. (Except than segfaults can occur for some union vars if they don't get reassigned when restarting the frame) It turns out that restart the frame alone is very useful because it happened so many times I debugged to fast and skipped a step, and had to relaunch pry.
@asterite if you interested I could send a draft of this on the compiler.
@I3oris Of course! Every improvement to the interpreter is very welcome. Plus I find it very fun to work with the interpreter, maybe you too. Oh, and if you want to try to plug your readline thing into the interpreter too, that would also be awesome (with that lib vendored like we vendor markd.)
Yes it super interesting to understand how the interpreter works, the more I go deeper in the code, the more I realize how hard it is to do a interpreter for crystal, that really a amazing work, thank you for created it!
Very glad to send PR to in the next days😀