Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When -code-watch flag is passed, reload all the code upon resume. #840

Merged
merged 1 commit into from
May 14, 2019

Conversation

technomancy
Copy link
Contributor

One of the biggest problems I ran into when working on my latest game jam entry was that the only way to make changes to the game state without restarting the whole game was eval which only takes a line at a time. I wanted to be able to reload my code and resume without wiping game state.

This patch implements that; when it detects that it is in "watch" mode, it automatically reloads all the game's code when you run resume in the console.

However, I'm not convinced that watch mode is the right way to determine whether to reload or not. For codebases that aren't written specifically to support reloading (that is, they do not preserve state in globals to keep them around between loads) resuming can act more like a full reset, which defeats the purpose of resuming; might as well just do run for that. So maybe another option would be to make the command take a param and only do this when someone runs resume reload instead?

I am open to other suggestions too; would love to hear your thoughts.

This allows you to reload without wiping all game state!

But maybe this should be a different flag?
Copy link
Owner

@nesbox nesbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@nesbox nesbox merged commit 7369fca into nesbox:master May 14, 2019
@nesbox nesbox added this to the 0.80.0 milestone May 14, 2019
@technomancy technomancy deleted the resume-reload branch May 14, 2019 15:28
@technomancy technomancy changed the title When --watch flag is passed, reload all the code upon resume. When -code-watch flag is passed, reload all the code upon resume. May 14, 2019
@nesbox nesbox removed this from the 0.80.0 milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants