5 ms·
> but the conventional static languages folks have generally needed to rely on support in sophisticated IDEs to get the same thing, and many end up going withou
by 59nadir 3y ago
> but the conventional static languages folks have generally needed to rely on support in sophisticated IDEs to get the same thing, and many end up going without
Not really, building and using shared libraries to do this has been trivial for decades.
- cxr 3y agoCan you point to examples that are in widespread use (or widely known)?
- jpc0 3y agoPlugin systems in a lot of software effectively are just dll/so files loaded at runtime, you could even enable reloading them at runtime. Usually you would want to hot reload the code sections though and allow the application to change the data section which is significantly more intuitive than changing source code to change data. Edit: On that note most game engines serialise state to disk, pretty sure it would be easy to just read the state from like a yaml file and update the state if you really don't want to write an interface. TLDR: There are significantly easier solutions to "how do I update the value of a variable at runtime" than hooking into the running process and changing the variable in memory.
- cxr 3y ago... what? Why is this posted as a reply to my question for examples?
- jpc0 3y agoThese are examples
- deleted 3y ago[deleted]
- cxr 3y agoThere are zero examples named in your comment, and your TLDR ("hooking into the running process and changing the variable") has no relevance to either the question you're ostensibly responding to ("Can you point to examples") or the subject of the blog post I originally mentioned ("a TWEAK macro to do this at the source level"). It's a baffling reply all-around.
- 59nadir 3y agoI don't think any game engine in use today except maybe the ultra-general ones would be without sections that are recompiled and reloaded live for gameplay code in this fashion. For all I know the ultra-general ones probably do it some stupidly complex way that sucks because they're overthinking things. Most setups will likely stream both code and assets to wherever the game is running while you're developing as well, but I wouldn't necessarily call that trivial. Recompiling a shared library and hot reloading it if it's changed is (on the order of 20 or so lines), though, and I wouldn't expect any game to be developed without at least some code being reloaded this way. While I haven't seen it as much, developing servers this way is also very doable, depending on how much you have to change data structures that have to be kept around. Edit: See https://www.youtube.com/watch?v=WMSBRk5WG58 https://www.youtube.com/watch?v=WMSBRk5WG58 for an example of how trivial it is to get this using just your OS facilities (`stat` + `LoadLibrary`/`dlopen`). None of this stuff is new and it's certainly been used with C/C++ or any language like it for a very, very long time.
- cxr 3y agoWhat are you talking about dude? I don't understand what's happening here. I asked for examples. I get in return two replies that have no examples and barely make sense in context. Do you have examples of what you said?
- 59nadir 3y agoI'm sorry, but if you don't understand what is being said to you I think the odds are pretty good that you were speaking out of turn when you were making proclamations about what developers usually do with static languages with regards to hot reloading code. If you don't know about dynamic loading of shared libraries and can't even parse these replies I think maybe you should just admit that you just didn't know what you were talking about when you said that. I don't have examples of this in open source projects because I don't have some list of open source games or whatever that I can point to (and honestly no one should have to give an example of something so trivial and well used). I sent you a video of someone doing this in less than 2 hours without even using non-OS dependencies. It's an example of someone actually doing it and showing how trivial it is to dynamically reload code when it changes in statically typed, ahead-of-time compiled languages, a class of languages you claimed don't have hot reloading of code without "complicated IDEs".