Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot reload #18

Open
yemi opened this issue Apr 25, 2023 · 2 comments
Open

Hot reload #18

yemi opened this issue Apr 25, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@yemi
Copy link

yemi commented Apr 25, 2023

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 yemi added the enhancement New feature or request label Apr 25, 2023
@irishgreencitrus
Copy link
Owner

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

@spytheman
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants