[GAP Forum] Reloading a package

Alexander Hulpke hulpke at fastmail.fm
Tue Mar 30 15:32:38 BST 2021


Dear Forum, Dear Piotr Mizerka, 
> I have the following question concerning loading of GAP packages
> (concerns in the same way both Linux and Windows). 
> 
> Suppose I have a package named "SamplePackage" located in the pkg
> directory. After launching a GAP session I load the SamplePackage with
> 
> LoadPackage( "SamplePackage" );
> 
> and it works fine. My problem is now as follows: I work "live" on the
> SamplePackage and I make a lot of changes and want to see the effect.
> Unfortunately after making a change in some of SamplePackage files and
> 
> Is there a way to reload the package in the same GAP session such that
> the updates are visible?

Since this is only an issue for a developer of the package, but not for the general user, there is no generic "reload" mechanism. What one can do is to reload individual files with `RereadPackage` (without causing warnings about objects already having been declared). You could simply reload the file you worked as:

```
RereadPackage("SamplePackage","/lib/myfile.gi");
```

If your changes go over multiple files, you could put all these `RereadPackage` commands into a single file you then read in.

One Caveat:
If you re-read a file that includes declarations, these prioperties get re-declared, and there might be some incompatibility with objects you created before re-reading the file.


Best,

  Alexander Hulpke




More information about the Forum mailing list