M
Modular3mo ago
gryznar

Can Mojo support hot reload in debugging session?

Just curiosity. Is this possible to replace code on the fly?
3 Replies
Darkmatter
Darkmatter3mo ago
Hot reload in languages with static typing tends to get very messy very quickly. When they are native compiled it gets even worse since the language has to deal with differences in type layout. The good news is that Mojo can run in a JIT mode where it doesn't try to optimize very hard (the repl), and what was historically the slowest part of LLVM (the optimizer) is mostly bypassed by Mojo. As a result, it should be reasonable to rerun the entire program to see your changes. This introduces some friction for GUI projects, but having another thread which gets through the GUI to the place you want to test is always an option while working in a particular area. Modular may be able to pull something off, but hot reload is primarily useful for two things: 1. GUI development. 2. Extremely long running distributed systems (think a single process running for 5 years with hot reloads being used to prevent downtime). Option 2 is something that a language has to be designed for from the start.
sb
sb3mo ago
*Option 2 can be accomplished relatively effectively with some runtimes even without language support, though it does introduce a different programming style
gryznar
gryznarOP3mo ago
Thank you all for the answers! My usecase is strongly related to to debug application (e.g. expensive in time to run). Ability to debug code, stop at exception and fix on the fly without need of restart, could be really handy
Want results from more Discord servers?
Add your server