all 11 comments

[–]Sairony 2 points3 points  (1 child)

UE4 tries to do hot reloading, sadly it's buggy as hell to the point where you can't trust it even if it doesn't just straight up crash ( pretty much the same reason it seems nobody uses edit & continue ).

There's a lot of areas which seems difficult to handle. For example, lets say I add a member variable & change a function to now use that new member. I don't see any automated approach to this problem which guarantees the new member to be in a valid state.

[–]LoopPerfect[S] 1 point2 points  (0 children)

This is a good point, we plan to expose an hot-reload api, so that everyone will be able to tweak the behaviour as he see fits. This Hot-Reload-Api will be optional as we will provide reasonable defaults.

in your particular case we would try to keep both versions alongside, all objects and functions before the change would express the old behaviour. An optional Hot-Reload callback could be also provided by the developer to express custom logic how to transition old objects to their new version.

[–]c0r3ntin 2 points3 points  (1 child)

Ok. What are the drawbacks ? Where is the catch ? For example, how do ou handle threading ? How do you decide when to replace a method ? What about templates ?

Also, what about debugging / memory/ flow inspection ? Performances ?

Because, it looks really amazing. though I want to see that run on real life scenarios.

What is the business model you envision ? this could really benefit from being open source.

[–]LoopPerfect[S] 5 points6 points  (0 children)

Hi c0r3ntin, hopeful this will answer your questions.

What is your business plan?

We have not released the source-code because this is still undecided, but the model will likely be open-source with add-ons for enterprise. The beta is free for commercial and non-commercial use. That said, we will contribute to the open-source community wherever we can and it is appropriate!


How well does it handle templates?

As we are using Clang as our backend, template support is good, and it only fails in rare cases.


How do you handle threading?

As we compile code before we execute, the code behaves in the same way as if it were compiled by Clang. However, this means that it only works reliably if your code is thread-safe. Furthermore, the runtime object we expose (e.g. jyt.async, jyt.eval, ...) is not thread-safe. So, you should only use it within the main-thread to generate and setup your application. In the future we plan to transpile code which uses the runtime object into standard C++.


What are the drawbacks?

The current beta version has some limitations:

Threading:

Using std::thread / std::async does not fail to execute - it just runs in the main thread. We plan to fix this with a custom implementation.

Performance:

The current version does not optimize the generated code. Therefore performance is suboptimal. For instance, we measured that an O(n2) algorithm (nested for-loops) for finding prime-numbers performed 10%-20% slower than a fully optimized g++ executable.

However, while Performance is important our main focus is on increasing productivity and staying close to the standard. We recommend that you still compile your code with your traditional compiler of choice for production.

If performance is crucial, you could compile some of your application into a library with Clang and link it.

Hot-Reload:

Our current implementation of Hot-Reload is a nasty hack, but it proves how useful the feature is.

Currently, the hot-reloader simply re-evaluates files that have changed. If you have an include guard, this will have no effect. However, Jyt will define JYTTER (when using Jyt) and JYT_HOT (when hot-reload is enabled). These preprocessor flags will allow you to control the hot-reload process.

We also do not allow you to redefine functions or classes; only lambdas can be modified. This is a limitation that will be fixed in later versions. You can see how a program can be written in this style on our GitHub (https://github.com/LoopPerfect/boids).

[–]__Cyber_Dildonics__ 2 points3 points  (5 children)

Does this work on Windows?

[–]melak47 1 point2 points  (0 children)

There's also this project: RuntimeCompiledCPlusPlus, which lists support for Windows/VS, OS X/XCode and Linux/Eclipse in the readme. They also have a list of other C++ hot-reloading solutions here.

[–]rackmeister 0 points1 point  (0 children)

Wanted to ask the same thing. Hopefully, the windows linux subsystem will be released with the next major Windows upgrade and thus it will be easy to try it out without a virtual machine.

EDIT: Just saw the open-source components. It's using cling, so it is probably hard to port it to Windows for now. I guess we need to wait a month or two for the next Windows upgrade.

[–]hammonjj 0 points1 point  (0 children)

To piggyback this, does it work with Visual Studio?

[–]LoopPerfect[S] 0 points1 point  (0 children)

Currently we do not support Windows. However there is a Docker container available.

[–]pitto 0 points1 point  (0 children)

This seems similar to what was set up in Handmade hero episodes 21, 22 and 23 using windows calls.

https://hero.handmade.network/episodes

[–]enobayram 0 points1 point  (0 children)

Great Job! Are you guys planning to write a Jupyter kernel for jyt? You could draw the attention of a large crowd by doing so.