Skip to content

Ensure file reload when using -fbytecode #880

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

Merged
merged 1 commit into from
Sep 18, 2015
Merged

Conversation

cmears
Copy link
Contributor

@cmears cmears commented Sep 16, 2015

With haskell-process-reload-with-fbytecode set to t, we first compile with object code, then switch to bytecode, touch the file and issue a :reload. However, if the .o file generated in the first compilation is still considered fresh -- because it has the same timestamp as the just-touched source file -- the reload doesn't do anything.

This patch makes the touch move the source code's timestamp into the near future, so that it's always newer than the object code. This way the reload will always recompile it. The mechanism is pretty ugly and a bit of a hack, but seems to work on Linux and OS X.

@gracjan
Copy link
Contributor

gracjan commented Sep 16, 2015

Good idea, implementation needs to be better. Please do the following:

That path should make this functionality much more manageable.

For reload-with-fbytecode, use ghci's ":load *<file>" form to force
interpretation instead of touching the file and hoping that :reload will
notice.
@cmears
Copy link
Contributor Author

cmears commented Sep 17, 2015

This implementation with touch is not so nice. I've just changed the pull request to a different method, which uses ghci's :load *<file> form, which asks it to ignore any object files and interpret the module. This avoids any updating of file timestamps. What do you think of this way?

@gracjan gracjan changed the title Touch files 5 seconds into the future Ensure file reload when using -fbytecode Sep 18, 2015
gracjan added a commit that referenced this pull request Sep 18, 2015
Ensure file reload when using -fbytecode
@gracjan gracjan merged commit d11f7b2 into haskell:master Sep 18, 2015
@gracjan
Copy link
Contributor

gracjan commented Sep 18, 2015

Nice. Much better than what was here before.

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