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

Fill in short definitons for keywords #540

Merged
merged 6 commits into from
Mar 23, 2017
Merged

Fill in short definitons for keywords #540

merged 6 commits into from
Mar 23, 2017

Conversation

carols10cents
Copy link
Member

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! ❤️

* `as` - primitive casting, or disambiguating the specific trait containing an
item
* `become` - reserved for future use
* `box` - reserved for future use
Copy link
Member Author

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
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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).

Copy link
Member Author

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.

@carols10cents
Copy link
Member Author

@matthewjasper thank you for your comments, as always! take another look? :) ❤️

Copy link
Contributor

@matthewjasper matthewjasper left a 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
Copy link
Contributor

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).

Copy link
Member Author

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
Copy link
Contributor

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.

@carols10cents
Copy link
Member Author

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).

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....

@steveklabnik steveklabnik merged commit fedd261 into master Mar 23, 2017
@steveklabnik steveklabnik deleted the keywords branch March 23, 2017 15:38
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.

3 participants