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

I love the feature but I am a little worried about how much more complex it would make the toolchain. How many extra LOC does this add to the compiler and linker (and how big are they now)?



Compiler and linker are 186,865 lines of code. My `hcs` branch which adds hot code swapping support for Linux (a companion PoC to the author of the OP) is 328 additions and 18 deletions [1]. And about 200 lines of those are adding ptrace constants to the std lib and a simple socket server to the compiler just as a method of issuing commands while the stdio is locked up in the running application.

Crazy right?

This is because incremental compilation & linking is actually the same problem as hot code swapping! This was just a natural fallout of the design of the compiler.

Same deal with Jakub's hot code swapping branch. It's 257 additions and 9 deletions and has the same ~150 lines of adding the socket server [2].

So in answer to your question, the PoC adds about 150 lines to an 186,865 line codebase.

[1]: https://github.com/ziglang/zig/compare/hcs

[2]: https://github.com/ziglang/zig/compare/hcs-macos


It's a great feature that might become one of the killer features of zig, among others. Very much worth the extra complexity.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: