Open mikestillman opened 2 weeks ago
I've heard of this complaint from a lot of people, and the answer has always been
¯\_(ツ)_/¯ yeah loadPackage is weird, just add
Reload => true
or use needsPackage!
I'd be in favor of ditching loadsPackage
(or making it a synonym of needsPackage), but the trouble is that it's hard to get
needsPackage` to reload a local copy of a package (e.g. a modified copy in the same directory) if a distributed version already exists on the system. This is related to the same issue I described in https://github.com/Macaulay2/M2/issues/3307#issuecomment-2171790406.
Sometimes, calling
loadPackage
can fail, saying it cannot be reloaded.This error occurred in a set of packages I wrote a few years ago. I have boiled it down to its essence:
In
A.m2
, place the codeIn
B.m2
, place the codeNow after creating these files, try the following code.
This last line fails, since the package ''A" has been loaded when "B" is being scanned for its newPackage code (I think), and so has already been loaded. This is very hard to determine, as any installed package could do this and cause the package to simply be loaded already... Using
needsPackage
works fine.Also, the time to install the package "A" seems to take 4-5 seconds on my machine, which seems quite large. (Same with "B").