5 ms·
Erlang, JavaScript, Ruby, Python come to mind. Dynamic languages which inherently don't expect data to have a statically enforced shape. Doing it in a statical
by dymk 4y ago
Erlang, JavaScript, Ruby, Python come to mind. Dynamic languages which inherently don't expect data to have a statically enforced shape.
Doing it in a statically typed language would be substantially harder, and to make it feel "good", probably require lots of tracking of library versions associated with particular data objects or strict isolation of how data passes across the library boundary. I don't think there's a great solution to be had.
- steveklabnik 4y agoThose all don’t let you change your data’s layout: they’re always behind a pointer, no? It’s a uniform representation.
- robertkrahn01 4y agoIn JS for example, if you change the prototype of an object you have effectively changed it's data layout but of course everything is behind a pointer / an indirection. When changing instance or class variables in Smalltalk, the system actually changing the object layout and goes and recompiles code using it. If you are interested in the details: Chapter 5 of [1] explains it a bit. [1] Hirschfeld et al. Assisting System Evolution: A Smalltalk Retrospective. http://soft.vub.ac.be/Publications/2002/vub-prog-tr-02-25.pdf http://soft.vub.ac.be/Publications/2002/vub-prog-tr-02-25.pd...
- steveklabnik 4y agoThanks!
- dymk 4y agoYes, the indirection (and also late binding) is why hot reloading is (somewhat) ergonomic in those languages, but would be difficult to do in Rust (or C++, etc). I think the shared library types would need to be indirected either via compiler support, or some kind of `Hot<T>` wrapper that acts like a `Box<T>` when hot reloading is enabled, and like a `T` in "production" mode to be ergonomic.
- forrestthewoods 4y agoHrm. I don’t think Python’s importlib.reload is used very broadly. Are those being hot-reloaded, or merely re-executed from scratch with no compile time? When I think hotreload I think “persist state but update code”. Persisting state safely when you change data layout is almost impossible. Even if the language is dynamic you’ll have stale objects that are missing the new members or didn’t go through the new initialization routine. I use hot reloading in C++ every day in Unreal Engine. However that only supports changing functions. If you change data layout you have to close the editor, rebuild, and relaunch.
- intelVISA 4y agoLive coding or hot reloading? The latter is deprecated and famous for corrupting data.
- forrestthewoods 4y agoLive coding. I consider it a form of hot reloading. The Live+ website states "Live++ enables hot-reload for C/C++ applications, combining the power of rapid iteration with the speed of a compiled language."
- intelVISA 4y agoWord I wasn't sure as UE has "both", do you find it useful in spite of the limitations?
- forrestthewoods 4y agoCritically useful. But I write a lot of code in C++ rather than blueprints. Turn around time from changing a line of code is under 10 seconds. Closing and relaunching the editor is actually not too bad, but probably 30 seconds?