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

Document notation #630

Merged
merged 4 commits into from
Oct 23, 2020
Merged

Document notation #630

merged 4 commits into from
Oct 23, 2020

Conversation

camelid
Copy link
Member

@camelid camelid commented Oct 22, 2020

Fixes #561.

Comment on lines 12 to 13
| `^0`, `^1.0` | [Bound variable] |
| `!0` | [Placeholder] |
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to say that this notation confuses me a bit; I just copied this part from the issue, so I would appreciate if someone more knowledgeable could double-check this :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look right. If these confuse you though, they most certainly confuse someone else. So, what confuses you?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, for one the syntax confuses me: what does 1.0 mean? It looks a floating point number, which I'm not used to seeing to represent a variable. I think it's a de Bruijn index, but I still don't fully understand it.

Also, I don't understand the difference between a placeholder and a bound variable/inference variable; the docs for it don't explicitly describe the difference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, so maybe it's worth describing the syntax here a bit. I'll describe a little bit here. I'm not quite sure the best place to put this though. (Or how much might be duplicated from other places in the book)

Inference variables have the format ?0. This means that in the current inference context, this is variable 0.

Bound variables can take the format of ^1.0 or ^0. In the former case, the 1 represents the Debruijn index of the variable. The 0 represents the index in that level of binding. For example, in forall<X,Y> { forall <Z> { X } }, X could be represented as ^1.0. If the Debruijn index is 0, then it may sometimes be omitted, leading the the second format ^0.

Placeholders take the format !1_0 or !0. For the former, the 1 is universe index of the placeholder whereas the 0 is the index in that universe. If the universe is 0, then it can be omitted, leading to the second format.

I'm not sure if this is the right place to explain placeholders vs bound or inference vars. I would have to think of a good explanation anyways. Let's just focus on notation here, for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the description! I'll add some of that to the docs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's an example of a rule where a placeholder would be created?

@camelid
Copy link
Member Author

camelid commented Oct 22, 2020

Not sure why CI is failing...

EDIT: It looks like it's partially because of #629.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These LGTM, other than the deletion of coherence?

book/src/SUMMARY.md Show resolved Hide resolved
@camelid
Copy link
Member Author

camelid commented Oct 23, 2020

Looks like rust,ignore is not working for some reason: it's still reporting doc test failures.

@jackh726
Copy link
Member

So, looks like a bunch of stuff in coherence.md isn't correct. Feel free to either 1) fix the errors with notrust or 2) just change the SUMMARY back and ignore the coherence doc for now.

I think the rust,ignore is working for the glossary.

* Fix formatting
* Use `notrust` for code blocks with invalid Rust syntax
* Use Unicode instead of LaTeX (LaTeX isn't supported)
@camelid
Copy link
Member Author

camelid commented Oct 23, 2020

Okay, CI should pass now! (except for linkcheck)

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks nice! Thanks!

@jackh726
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 23, 2020

📌 Commit ef3b576 has been approved by jackh726

@bors
Copy link
Contributor

bors commented Oct 23, 2020

⌛ Testing commit ef3b576 with merge fc7cb87...

@bors
Copy link
Contributor

bors commented Oct 23, 2020

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing fc7cb87 to master...

@bors bors merged commit fc7cb87 into rust-lang:master Oct 23, 2020
@camelid camelid deleted the notation-docs branch October 23, 2020 22:42
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

Successfully merging this pull request may close these issues.

Add a "notation" section to the glossary of the book
3 participants