-
Notifications
You must be signed in to change notification settings - Fork 160
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
ReadPackage
should error when given an invalid path, not silently proceed
#5745
Comments
I agree this behaviour is bad, and we should change it. If anyone asks for the current behaviour, we can add a function which provides it (I wouldn't bother adding that until anyone wants it) |
I experimented with this. Turns out, as usual if one is lax about enforcing something, it gets misused, whether intentionally or accidentally sigh.
Analysis:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider this:
I think that's really problematic behavior. Because it means that if one has a typo in a package's
init.g
orread.g
, one may have to search for quite a bit before discovering this.It also has other consequences: if a file is missing by accident (error copying it over, whatever), this may manifest in weird errors.
I have one setup were multiple GAP's are loaded in parallel on a multi-core machine, and a certain path goes through a symlink, and for (bad) reasons each time a new GAP is started, that symlink is recreated. I've fixed this by now (I think) but it manifested in a really confusing way: a package would load just fine, but then later calling into it, it might complain about some function not being defined... That can happen if you read the file with
DeclareGlobalFunction
but not the one withInstallGlobalFunction
. This one confused me a lot initially because it was obvious that files both before and after the file with theInstallGlobalFunction
call had been read.All in all, I have by now encountered (and described) multiple situations where having
ReadPackage
raise an error would be beneficial.Can anyone name a plausible reason where the current behavior is preferable? (The fact that it is "documented behavior" is true but not a reason by itself, as we can always change this).
If not I'd really like to change this in 4.14 (or even before, really).
Note to anyone trying to implement this:
RereadPackage
is implemented by callingReadPackage
but it would be bad ifReadPackage
raised an error, as that would leaveREREADING
in the wrong state. So implementation wise, one could either add another optional argument or an option toReadPackage
to make it return a bool again instead of raising an error; or one could renameReadPackage
into_ReadPackage
(which would still return a bool) and then call that from bothRereadPackage
and a newReadPackage
.The text was updated successfully, but these errors were encountered: