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

Write design doc for yoke #1459

Merged
merged 9 commits into from
Jan 8, 2022
Merged

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Dec 31, 2021

Part of #1474

This should be a good step for making it possible for others to understand this crate. I also plan to use parts of the "high level design" section of this as crate-level docs for this crate.

I'll be writing a similar doc for ZeroVec as well (#1475)

cc @echeran @nordzilla who I think expressed interest in understanding this crate better and potentially helping out with patches/reviews (though this crate is not changing much anymore)

@Manishearth Manishearth requested a review from sffc as a code owner December 31, 2021 00:40
@@ -1,20 +1,18 @@
# Yoke: Lifetime Erasure for Rust
# Yoke: Self-Referential Borrowing for Rust
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sffc I'd really prefer to call this "lifetime erasure", "self referential borrowing" is a huge field in Rust with many crates already. When explaining what yoke does to other rustaceans I've found "lifetime erasure" to be quite clear since it makes a clear analogy with "type erasure" (dyn)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see lifetime erasure as being a means to an end. Yoke applies its lifetime erasure to a very narrow use case, which is self-references. I took another stab at the headline which mentions both things.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still kinda feel like the relationship is inverted: the point of Yoke is lifetime erasure, and it accomplishes that by self referential borrowing. There's no way lifetime erasure can work without self referential borrowing as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately, to me, "self referential borrowing" does not tell me much because it covers so many things. "lifetime erasure" tells me exactly what this crate is useful for: I want to turn a compile time lifetime into an erased runtime one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like, to be clear, by "lifetime erasure" I'm not talking about the fact that yoke replaces lifetimes with static as a means to an end.

I'm making an analogy against type erasure: turn a compile time construct into a runtime one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me write it out in the doc

utils/yoke/design_doc.md Outdated Show resolved Hide resolved
sffc
sffc previously approved these changes Jan 7, 2022
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied my feedback directly in your branch. Feel free to counter-edit my suggestions.

@Manishearth Manishearth requested a review from sffc January 8, 2022 00:13
sffc
sffc previously approved these changes Jan 8, 2022
@Manishearth Manishearth merged commit 66fe4b7 into unicode-org:main Jan 8, 2022
@Manishearth Manishearth deleted the design-doc-yoke branch January 8, 2022 01:11
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.

2 participants