Skip to content
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

spurious ;; are added #368

Open
c-cube opened this issue Feb 10, 2022 · 3 comments
Open

spurious ;; are added #368

c-cube opened this issue Feb 10, 2022 · 3 comments

Comments

@c-cube
Copy link

c-cube commented Feb 10, 2022

I have lines like:

# v;; (* now v is a mutable vector *)
- : (int, CCVector.rw) CCVector.t = <abstr>

and mdx now gives me a diff like:


-# v;; (* now v is a mutable vector *)
+# v;; (* now v is a mutable vector *);;
 - : (int, CCVector.rw) CCVector.t = <abstr>

(to reproduce, make test in https://github.com/c-cube/ocaml-containers )

@NathanReb
Copy link
Contributor

As of 2.0, it is recommended that MDX toplevel phrases are ;; terminated. If the phrase is valid but not ;; terminated it will add them in the output. In 3.0 we'll refuse non ;; terminated phrases as input.

This example is indeed a bug and we need to fix it. What I'm not sure is what the right fix is, and my first impression is that it would reject your phrase, or rather reject the comment which is neither part of the phrase itself nor part of the toplevel output.
I'm a bit surprised your initial example used to work in the first place and would consider it a bug on our side to accept it.

Would it be acceptable for you to put the comment inside the phrase in such a fashion:

# v (* now v is a mutable vector *);;
- : (int, CCVector.rw) CCVector.t = <abstr>

Another option would be to make the comment part of the document rather than the block, if the above syntax doesn't quite suit you:

```ocaml
# (* some previous code *) ...
...
```
Now v is a mutable vector:
```ocaml
# v;;
- : (int, CCVector.rw) CCVector.t = <abstr>
```

@c-cube
Copy link
Author

c-cube commented Feb 11, 2022 via email

@Leonidas-from-XIV
Copy link
Collaborator

With #398 this issue could be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants