Search code examples
xmlcoqcoq-tacticcoqide

what is the "editId" in Coq's XML Protocol document?


In Coq's XML Protocol document (for the Add operation), a line reads <int>${editId}</int>. What is the editID here?

I asked this because I failed to interact with coqtop in the ideslave mode. Using coq-8.6.1/theories/FSets/FSetCompat.v as an example, I inputted

<call val="Init"><option val="none"/></call>

,

<call val="Add"><pair><pair><string>Require Import FSetInterface FSetFacts MSetInterface MSetFacts.</string><int>1</int></pair><pair><state_id val="1"/><bool val="true"/></pair></pair></call>

,

<call val="Add"><pair><pair><string>Set Implicit Arguments.</string><int>1</int></pair><pair><state_id val="2"/><bool val="true"/></pair></pair></call>

, and then

<call val="Add"><pair><pair><string>Unset Strict Implicit.</string><int>1</int></pair><pair><state_id val="3"/><bool val="true"/></pair></pair></call>

They all generated correct outputs. However, at this time when I typed

<call val="Add"><pair><pair><string>Module Backport_WSets
    (E:DecidableType.DecidableType)
    (M:MSetInterface.WSets with Definition E.t := E.t
                           with Definition E.eq := E.eq)
<: FSetInterface.WSfun E.</string><int>1</int></pair><pair><state_id val="4"/><bool val="true"/></pair></pair></call>

I got the following error:

[pid 48519] XML syntax error: Attribute value expected
[pid 48519] XML syntax error: Xml node expected
[pid 48519] XML syntax error: Xml node expected
[pid 48519] Unexpected XML message
[pid 48519] Expected XML node: call
[pid 48519] XML tree received: <int>1</int>
[pid 48519] XML syntax error: Xml node expected
[pid 48519] Unexpected XML message
[pid 48519] Expected XML node: call
[pid 48519] XML tree received: <pair>
  <state_id val="4"/>
  <bool val="true"/>
</pair>
[pid 48519] XML syntax error: Xml node expected
[pid 48519] XML syntax error: Xml node expected

I suspect that this error is because of the multi-line string, and maybe if I change editId, I should get the correct answer. Am I right? If no, what does editID do, and how should I deal with this error? Thanks for helping!


Solution

  • EditId was removed in Coq 8.7; its original purpose and history is a bit complex due to intricacies of the protocol and historical issues.

    Namely, the Add operation is synchronous in the sense that the user interface has to wait for a reply with the newly assigned identifier (Stateid.t) for the added span.

    However, if a parser error occurred, the asynchronous feedback system needed a temporal identifier, edit_id served that purpose.

    We removed edit_id as Add is synchronous anyway, so it makes sense for the caller of Add to use the synchronous error handler instead of the edit_id-based feedback.

    Note that I strongly recommend against using the current synchronous version of Add. It forces the client to implement a complex blocking system, and it will be replaced soon by an asynchronous-friendly version [where the UI chooses the span_id upfront] . Such a version is already available in the ML API and exposed by SerAPI (*) and likely by the XML protocol itself starting in 8.8.

    (*) The usual disclaimers apply: I am the author of SerAPI, also note that I was the person behind the removal of edit_id from Coq 8.7.