-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add a picture to Rc #2583
Add a picture to Rc #2583
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.
Very nice. Thank you.
src/smart-pointers/rc.md
Outdated
: : : : | ||
: +-----+ : : +-------------+-----------+ : | ||
: a: | o---|---:-----:-->| strong: 2 | weak: 0 | : | ||
: +-----+ : : +-------------+-----------+ : |
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.
Is there a way to use an "upside-down T" (or "bottom", as us logicians call it) at the lower end of the line separating the "strong" and "weak" cells?
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.
src/smart-pointers/rc.md
Outdated
.- - - - - - - -. .- - - - - - - - - - - - - - - - -. | ||
: : : : | ||
: +-----+ : : +-------------+-----------+ : | ||
: a: | o---|---:-----:-->| strong: 2 | weak: 0 | : |
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.
Why not make it weak: 2
and say that every strong reference is also considered a weak reference. Or just leave this slight "lie". I don't think people taking this course need this level of detail to be correct.
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 just omitted the "weak" bit -- that can remain an implementation detail :)
Thanks for this change--I was teaching this slide recently and wished I had a diagram instead of describing the memory layout of |
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 think this is a good level of detail. Thank you.
I suppose my
svgbob
skills leave a bit to be desired, but I think the meaning is clear:Now that I look through the
Rc
implementation, there's a weak count for every strong count, so theweak: 0
here is inaccurate. But, maybe this is too much of an implementation detail? Should I just concentrate on strong refs? I suppose I could put a...
in that upper-right box, to suggest there's more going on here?