0

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!

Jian Wang
  • 103
  • 5

2 Answers2

1

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.

ejgallego
  • 6,709
  • 1
  • 14
  • 29
  • Thank you for your answer! The blocking is inconvenient indeed. I circumvented it by using a pty. I should try your SerAPI in the near future! Could you tell me why the error occurred when I feed in a multi-line string with "Add" (as shown in my question)? – Jian Wang Dec 06 '17 at 03:01
  • You likely need to encode the line break using and html entity? It is instructive to see what CoqIDE `-debug` does. – ejgallego Dec 06 '17 at 03:11
  • Thanks! @greybeard just told me to change the `<` sign to `<` and then the error was gone. So the error was not about line breaks. Thank you for your answer for edit_id! – Jian Wang Dec 06 '17 at 17:58
  • Yup you need to encode quite a few things, see here the current quotings used in CoqIDE itself: https://github.com/coq/coq/blob/v8.7/ide/xml_printer.ml#L19 – ejgallego Dec 06 '17 at 23:38
0

It doesn't seem to hurt to send an editid for an Add, even in 8.7, even if it's unused on the Coq side.

My XML-based fork of Proof General includes an editid for Add with 8.7, and no error occurs as a result.

Paul Steckler
  • 617
  • 5
  • 19