Live data from Hacker News

C and C++ Hot-Reload/Live Coding

liveplusplus.tech

91–100 of 102 posts

Re: C and C++ Hot-Reload/Live Coding

#91
post #64

Earlier quoted context omitted.

you might be getting downvoted for conflating REPL with JIT, but there's definitely a place for a C++ REPL (and anyway, with ROOT/cppyy you can basically use inline C++ in python REPLs)

REPL is just an interface on top. It complicates the whole thing even further, but it's not the root (no pun intended) of the problem. >you can basically use inline C++ in python REPLs That's exactly what I was getting at. There's no need for a pure C++ interactive environment. Just use python at this point.

No, in my experience with Python and its REPLey incarnations, I would have felt much more at peace if there was a good and reliable C++/Rust REPL.

And if that's in a familiar language, then even better. Clojure is a good choice, but I am still learning it.

Note: I am a lone programmer building Quant Engineering subsystems for personal purposes. So evaluate (pun intended :D) my opinion in that context.

Re: C and C++ Hot-Reload/Live Coding

#92
post #90

Earlier quoted context omitted.

And it's unbelievably bad in Unreal as well. They do so much shady hooks and memory management / GC under the hood that Unreal C++ is effectively more like Java or C# at this point. They would save devs a ton of headache if they just went all the way like Unity. C++ has its uses - but those are definitely not it.

C++ was already Java and C# before they came to be, as experienced in tooling like Energize C++, Visual Age for C++, and C++ Builder. The problem is that too many people insist in using it like C. Is as if one changes the JavaScript file extension to Typescript, and then keeps writing JavaScript ES3 on it.

That's true and it's why C++ development has become a nightmare over the past decades. I don't see why people need to cram every idea into a single language, especially one that was designed to be so close to hardware. If I want the comfort of high level stuff, I use a high level language.

Re: C and C++ Hot-Reload/Live Coding

#93

Earlier quoted context omitted.

REPL is just an interface on top. It complicates the whole thing even further, but it's not the root (no pun intended) of the problem. >you can basically use inline C++ in python REPLs That's exactly what I was getting at. There's no need for a pure C++ interactive environment. Just use python at this point.

No, in my experience with Python and its REPLey incarnations, I would have felt much more at peace if there was a good and reliable C++/Rust REPL. And if that's in a familiar language, then even better. Clojure is a good choice, but I am still learning it. Note: I am a lone programmer building Quant Engineering subsystems for personal purposes. So evaluate (pun intended :D) my opinion in that context.

>in my experience with Python and its REPLey incarnations, I would have felt much more at peace if there was a good and reliable C++/Rust REPL

How so? My experience is exactly the opposite.

Re: C and C++ Hot-Reload/Live Coding

#94

Earlier quoted context omitted.

> Debuggers might hot-patch code to insert breakpoints, but that's not the same thing as replacing running code. Solaris dbx did have this capability -- patch and replace code with newly compiled code from your updated source files -- circa 2000. You just typed "fix" and it worked. I've been wishing for that capability on x86 Linux ever since.

Nice! I never knew, and used dbx lots!

God, it was so, so convenient. Near instant turnaround time for fixes. It was especially good in combination with 'pop', which returned control to the calling function just before calling the current one. It gave you a sort of limited form of do-over, with the caveat that it didn't try to undo any effects of the called function so far. Or you could just fix and restart.

Re: C and C++ Hot-Reload/Live Coding

#95

Earlier quoted context omitted.

No, in my experience with Python and its REPLey incarnations, I would have felt much more at peace if there was a good and reliable C++/Rust REPL. And if that's in a familiar language, then even better. Clojure is a good choice, but I am still learning it. Note: I am a lone programmer building Quant Engineering subsystems for personal purposes. So evaluate (pun intended :D) my opinion in that context.

>in my experience with Python and its REPLey incarnations, I would have felt much more at peace if there was a good and reliable C++/Rust REPL How so? My experience is exactly the opposite.

Stateful Hot-Reload/REPL Workflows that I used/use: I have used Emacs+Jupyter in the past, also played around with Jurigged, and currently I use the 'Send to Repl' functionality available in PyCharm.

Still, there are rough edges,

1. Rough: No (ergonomic) expression-evaluation available at the moment, hopefully tree-sitter based tools will solve this in the future.

2. Rougher: In the general case, I can't redefine a function/class. The 'global' namespace can be used to 'some extent' to achieve 'deterministic redefinition', but the code strays away from idiomatic Python.

3. Roughest: I have found Python performance to always be a concern. Maybe I am biased towards C/C++/Rust for performance purposes, aka Optimal Resource Utilization.

Re: C and C++ Hot-Reload/Live Coding

#96
post #40

You don't need anything complicated for this. All you need is to compile your code to a shared library that exports an 'update' method. See https://github.com/TomSmeets/quest-for-nothing/blob/master/a... You have to be careful with global variables however, they will get cleared to zero when the code is reloaded. To solve this either don't use globals or just restore them on reload.

Not having globals at all or restoring them on reload isn't exactly "don't need anything complicated for this", especially considering using a generic hot-reload tool on AAA 5M+ LOC projects.

There's no easy way to retrofit hot-reload into these large codebases. Sure, it's easier if you design everything up-front with hot-reloading in mind, but it's still going to be hard to convince developers that they cannot use globals, thread-local storage, function statics, or other inherently stateful things that just won't work with DLL reloading.

Re: C and C++ Hot-Reload/Live Coding

#97

Wow—a commercial offering exclusively targeting Windows, C++, and game development, and yet showcased on Hacker News. A rare combination indeed! :P EDIT: The deep dive[1] on their webpage is absolutely worth a read. [1]: https://liveplusplus.tech/downloads/THQ_Nordic_Dev_Summit_20...

Note that it's not exclusively targeted to game development, it's just that most companies using Live++ are in the gamedev space. There's no reason not to use Live++ on other non-games Windows applications, and we do in fact have customers outside the games industry.

Re: C and C++ Hot-Reload/Live Coding

#98
post #79

First, I'm really happy about all those solutions for the gaming industry! They solve real-world problems and work with software at scale, with great pragmatism. But I would have liked to see a comparison of this solution to others on the market, like the readily-available "Hot Reload" in Microsoft Visual Studio. For a multi-MLOC codebase, VS "Hot Reload" required some patience, and it mostly worked only for simple c…

We're using Live++ at Mojang. For very large complicated software, we never had any success with VS Hot Reload. Live++ works like a dream and has had noticeable productivity improvements for the devs that've tried it.

Re: C and C++ Hot-Reload/Live Coding

#99

Earlier quoted context omitted.

>in my experience with Python and its REPLey incarnations, I would have felt much more at peace if there was a good and reliable C++/Rust REPL How so? My experience is exactly the opposite.

Stateful Hot-Reload/REPL Workflows that I used/use: I have used Emacs+Jupyter in the past, also played around with Jurigged, and currently I use the 'Send to Repl' functionality available in PyCharm. Still, there are rough edges, 1. Rough: No (ergonomic) expression-evaluation available at the moment, hopefully tree-sitter based tools will solve this in the future. 2. Rougher: In the general case, I can't redefine a f…

The only thing I can agree on here is performance, but I already included that aspect before. I don't see how existing expression evaluation could be more or less "ergonomic." It is what it is and it's already far better than anything for C/C++. And since classes and functions are all objects in python and there are no private members, everything is trivial to redefine in practice. I do this constantly.

Re: C and C++ Hot-Reload/Live Coding

#100
post #79

First, I'm really happy about all those solutions for the gaming industry! They solve real-world problems and work with software at scale, with great pragmatism. But I would have liked to see a comparison of this solution to others on the market, like the readily-available "Hot Reload" in Microsoft Visual Studio. For a multi-MLOC codebase, VS "Hot Reload" required some patience, and it mostly worked only for simple c…

There is a comparison between Live++ and Visual Studio's Edit-and-Continue here: https://liveplusplus.tech/faq.html

In our (and many of our customers') experience, E&C doesn't work for anything larger than simple toy projects. It just isn't reliably.

On top of that, I think its biggest shortcoming is that E&C doesn't work with optimizations at all (this is documented), and is tied to the Visual Studio IDE, which not everybody uses.

Post reply on HN