-
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
Are annotations explained? #1333
Comments
They're called "attributes" and they're largely mentioned in passing. We could do a better job with them for sure. |
@carols10cents , do you have any idea if and where we would fit more in about attributes? |
I concur that helping newbies like me find documentation on attributes, which are quite ubiquitous but hard to search for, is important. I found myself searching (ctrl-f in browser) in the documentation for '#' and 'pound' to no avail. A google search yielded this laconic explanation: Those pound sign thingies As a simple step in that direction, I've added both a pound sign and the word Chapter 19 on macros covers more of them. |
As a newbie (with a Python background), "5.2 An Example Program Using Structs" left me with the impression that there is a first-class feature named "Annotations", and I then tried to find documentation for. Calling |
Also, I find the wording "attribute-like macro" confusing. It makes me wonder what makes them not true attributes. But they are attributes as best as I can tell-- they start with Now, the macro definitions themselves aren't attributes, but they're not "attribute-like" either. The Rust reference refers to them as "attribute macros". https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros and I think it would be good use terminology that's consistent with the reference. |
The historical reason they were called "attribute-like macros" is because they are macros, but they look like attributes. It is true that they are attributes. It really depends on where you put the focus. I do think that, if the lang team wants to call them "attribute macros," that's fine by me. I'm happy to do whatever the lang team prefers wtih regards to naming here. |
Hi I've been reading the 2nd edition but this issue also seems to apply to the 2018 one.
The book has in general done a very good job of explaining things as you read, or telling you that something will be explained later.
However while reading about derived traits (in section 5.2) I read this
This shows the code to add, but it does not seem to explain what annotations are and how they work. It is perhaps the fist instance in this book where I have been left wondering about how something works.
I was expecting something like 'we talk about annotations in more detail in chapter X', or conversely having them mentioned after comments in the common language constructs section.
The text was updated successfully, but these errors were encountered: