7

Am able to load and call the functions but I would like to reload the file after making some corrections.

Cant find either an unload or reload function?

2 Answers 2

11

Unloading is not really possible. It is for example possible to delete a package and thus remove its definitions. But other references to a symbol of that package might still exist.

The typical way to deal with that is to load a file again, as Vijay Mathew mentioned.

It might be helpful that the file loaded is written in such a way that reloading is possible.

A few remarks on reloading:

  • functions/macros will be replaced with the new definition.

  • functions/macros in existing code may not be replaced due to inlining/macro expansion.

  • CLOS classes will be updated, its instances will be lazily updated.

  • Structure definitions will be updated, existing structure instances will not be updated.

  • DEFVAR replaces a value if one doesn't exist. DEFPARAMETER always replaces a value.

Sign up to request clarification or add additional context in comments.

1 Comment

I realize this is an old answer, but here we go. It’s worth mentioning that any functions/macros/etc. you may have deleted from the file will still hang around, polluting the image and possibly causing behaviour that you would not see in a completely clean build.
6

Just use load again.

1 Comment

As @user713516 points out, if you deleted or renamed functions or variables from your file, reloading it will not delete those old definitions. This will be very confusing if you forget a reference to such an old definition: it will still be called and you'll wonder why the new definition isn't working. Lisp's REPL based reload workflow is the only one suffering from this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.