NamseEnt / namseent

Mono Repository for Namse Entertainment Ltd.
GNU Affero General Public License v3.0
13 stars 2 forks source link

Shared library for hot reload #757

Open namse opened 10 months ago

namse commented 10 months ago

To achieve hot reload, user's code should be shared library(or wasm), which we can load/unload during execution.

For example,

  1. the runtime which runs user code and links that to heavy, unchanging libraries.
  2. user code which compiled to shared library to load/unload during execution
  3. the heavy, unchanging libraries during editing user code
    • for example, namui or ffmpeg etc

So, runtime keep memory state even on reload user code. we can refresh small amount of component which the type of state or props changed.

What we need to research is

  1. the detailed architecture
  2. how to reduce the size and compile time of shared library from user code
  3. how to link between user code and heavy libraries
namse commented 10 months ago

prototype example https://github.com/namse/rust-plugin-example

using function pointer setting.

extern "Rust" with dylib seems not working. So I decided to use function pointer setting.

namse commented 10 months ago

I think hot reload is very dangerous depending on what kind of state user will save in hooks system.

Some topics we have to research,

  1. Arc
  2. Determining the type(and it's field) has been updated or not