-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Updated static and const #1881
Updated static and const #1881
Conversation
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.
This mostly looks good, I just have a few minor requests for tweaks.
src/user-defined-types/const.md
Outdated
@@ -0,0 +1,39 @@ | |||
# `const` | |||
|
|||
Constant variables are evaluated at compile time and their values are inlined |
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.
One minor request: Could you change the wording here to not refer to constants as "variables"? That was a minor tweak I've been meaning to make, and it seems reasonable to do it here since you're reworking the pages already.
Constant variables are evaluated at compile time and their values are inlined | |
Constants are evaluated at compile time and their values are inlined |
src/user-defined-types/static.md
Outdated
# Static and Const | ||
|
||
Static and constant variables are two different ways to create globally-scoped | ||
values that cannot be moved or reallocated during the execution of the program. |
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.
Can you remove this heading? This slide is about statics, and I think this little introductory header is unnecessary clutter.
src/user-defined-types/static.md
Outdated
- `static`, on the other hand, is much more similar to mutable global variable | ||
in C++. |
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.
- `static`, on the other hand, is much more similar to mutable global variable | |
in C++. | |
- `static` is similar to mutable global variables in C++. |
src/SUMMARY.md
Outdated
- [Static and Const](user-defined-types/static.md) | ||
- [Const](user-defined-types/const.md) | ||
- [Properties](user-defined-types/properties.md) |
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.
- [Static and Const](user-defined-types/static.md) | |
- [Const](user-defined-types/const.md) | |
- [Properties](user-defined-types/properties.md) | |
- [Statics](user-defined-types/static.md) | |
- [Constants](user-defined-types/const.md) |
Per my suggestion, could you remove the properties slide and then remove the extra level of nesting here? The title of the first slide can also change to just "Statics" since it's not introducing both concepts anymore.
src/user-defined-types/properties.md
Outdated
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.
I don't think we need this properties slide. This info was originally in the speaker notes and it felt pretty superfluous to me. I think we can remove this content, and move the "More to Explore" section to the speaker notes on the statics slide.
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.
LGTM otherwise, pending @randomPoison's approval.
@@ -62,7 +62,8 @@ | |||
- [Named Structs](user-defined-types/named-structs.md) | |||
- [Tuple Structs](user-defined-types/tuple-structs.md) | |||
- [Enums](user-defined-types/enums.md) | |||
- [Static and Const](user-defined-types/static-and-const.md) |
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.
Don't forget to add a redirect in book.toml
for the old path.
Oh, I forgot about book.toml. I'll add that now. |
I missed this in #1881 before clicking "merge".
Motivation: * const usecases are likely more familiar than static usecases * currently the static slide refers `const`, before it's introduced Background: static and const were previously on the same slide, with const being introduced first ( #1881 ) but when they were split, static was moved first.
Updated the content for space issue .
#1464 issue.