PG icon indicating copy to clipboard operation
PG copied to clipboard

Why retracting before restarting coqtop?

Open Matafou opened this issue 1 year ago • 3 comments

Following a remark by @SkySkimmer.

Currently when the user asks for scripting a different file than the current one PG does the following things:

  1. ask for retracting the current one (which is ok),
  2. then retract the file (which may be costly or even fail as shown by the initial remark),
  3. and finally kills coqtop and restarts it on the new file (re-detecting options etc).

Step 2. seems fragile and useless. Asking before changing the scripting buffer (step 1) is of course important, but then jumping to step 3 seems ok. In particular step 3 removes all locks on buffers and relaunching scripting mode re-locks what is needed.

Any reason not to propose a PR in this direction?

Matafou avatar Jun 07 '24 07:06 Matafou

I introduced killing coqtop with multiple file support around 2012, because at that time required files could not be unloaded. I would guess retracting is generic behavior, maybe caused by killing all spans in the current buffer. I don't see any reason for not shortcutting the procedure. Does coqtop reliably unload all required stuff (including ML plugins) nowadays? If yes, since when? May we can even abandon the killing.

hendriktews avatar Jun 20 '24 08:06 hendriktews

Actually as explained by @SkySkimmer there are reasons to kill coqtop. Requires are still not correctly unloaded.

https://coq.zulipchat.com/#narrow/stream/304019-Proof-General-users/topic/Restarting.20ProofGeneral/near/442904710

Hence my suggestion is the opposite: since we need to kill coqtop why first try to retract the file?

Matafou avatar Jun 21 '24 05:06 Matafou

I don't see a reason to retract before kill. I have not investigated why this is happening at all.

hendriktews avatar Jun 21 '24 08:06 hendriktews