3 ms·
Those all don’t let you change your data’s layout: they’re always behind a pointer, no? It’s a uniform representation.
by steveklabnik 4y ago
Those 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.