-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fill in short definitons for keywords #540
Conversation
* `as` - primitive casting, or disambiguating the specific trait containing an | ||
item | ||
* `become` - reserved for future use | ||
* `box` - reserved for future use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik there's no plans to stabilize box
in the near future, soooo calling it "reserved for future use" since that's not a lie
* `abstract` - reserved for future use | ||
* `alignof` - reserved for future use | ||
* `as` - primitive casting, or disambiguating the specific trait containing an | ||
item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and renaming items in use
and extern crate
statements.
@@ -4,55 +4,57 @@ The following keywords are reserved by the Rust language and may not be used as | |||
names of functions, variables, macros, modules, crates, constants, static | |||
values, attributes, struct fields, or parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm here, this is missing types, traits, generic lifetimes, loop labels and macro matchers. Yes, the last two are kind of obscure.
It is probably better to make this 'identifiers such as names of functions ...' and just include types, traits and lifetimes.
* `Self` - implementor type alias | ||
* `self` - method subject | ||
* `sizeof` - reserved for future use | ||
* `static` - global variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And in 'static
?
* `ref` - by-reference binding | ||
* `return` - return from function | ||
* `Self` - implementor type alias | ||
* `self` - method subject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current module, and some extra stuff in import paths.
* `match` - pattern matching | ||
* `mod` - module declaration | ||
* `move` - part of closure syntax | ||
* `mut` - denotes mutability in pointer types and pattern bindings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'reference and raw pointer'?
* `macro` - reserved for future use | ||
* `match` - pattern matching | ||
* `mod` - module declaration | ||
* `move` - part of closure syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps say what it does, e.g., 'makes a closure copy/move its captures from the environment'.
* `where` | ||
* `while` | ||
* `yield` | ||
* `abstract` - reserved for future use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all reserved keywords be collected together at the end?
syntax | ||
* `if` - conditional branching | ||
* `impl` - inherent and trait implementation block | ||
* `in` - part of `for` loop syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's looking to be stabilised soon, pub(in path)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to put pub(thing)
in the newest features appendix, which isn't going to be in print, so I think we should leave it out of the printed keyword index. Actually, I might be convinced otherwise, since there are other things in this keyword index we don't really talk about in the book.... idk. I'm going to leave it out for now at least until it's stable.
Also reorder by likelihood of encountering, ish.
@matthewjasper thank you for your comments, as always! take another look? :) ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have appropriate references to the main text, but I'm not sure how you're planning to do those (also the chapter and section headings are not stable enough yet).
* `break` - exit a loop immediately | ||
* `const` - constant items and constant raw pointers | ||
* `continue` - continue to the next loop iteration | ||
* `crate` - external crate linkage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$crate
? (macros 2.0 can't come soon enough).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o.O i had no idea that even existed
* `pub` - denotes public visibility in struct fields, `impl` blocks, and modules | ||
* `ref` - by-reference binding | ||
* `return` - return from function | ||
* `Self` - implementer type alias |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Alias for implementer type'? or maybe even more words.
I'm not planning on doing those. I'm envisioning this index to be "what is this word for?" and a quick explanation... for the print book, we'll be doing a real index. For the online book, it'd be nice to have search someday... there's always going to the one-page print view and ctrl-f.... |
Mostly cribbed from the syntax index in the old book. I might have messed up or not been as descriptive as I could be, even in a short definition... I'd love reviews! ❤️