raylib.v icon indicating copy to clipboard operation
raylib.v copied to clipboard

Hot reload

Open yemi opened this issue 2 years ago • 2 comments

Describe the solution you'd like

Ability to hot reload code changes. Is it possible at all using v's native hot reloading or otherwise?

Reasons why this should be a part of the core library

It would speed up development significantly, making this lib more attractive as a replacement for native c.

yemi avatar Apr 25 '23 18:04 yemi

Are there any other C bindings that work with hot reloading? Otherwise, I'm not sure how I could approach this.

irishgreencitrus avatar Apr 28 '23 06:04 irishgreencitrus

It is a V feature, available when compiling a program with v -live run program.v. It relies on tagging specific functions with @[live], then when you change them, the updates will be detected by the running program, it will recompile a shared library with the changed source, and reload it, effectively replacing the previous versions with the new ones, without losing state.

It is mainly useful for application code, where you want to tweak some algorithm, or some hardcoded values like coordinates or colors in those functions, similar to how you can tweak CSS live in a web browser inspector. It is not well suited for libraries like the raylib wrapper here.

spytheman avatar Jan 27 '24 16:01 spytheman