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

Tracking Issue for ops::Yeet (feature(try_trait_v2_yeet)) #96374

Open
4 tasks
scottmcm opened this issue Apr 25, 2022 · 13 comments
Open
4 tasks

Tracking Issue for ops::Yeet (feature(try_trait_v2_yeet)) #96374

scottmcm opened this issue Apr 25, 2022 · 13 comments
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@scottmcm
Copy link
Member

scottmcm commented Apr 25, 2022

Feature gate: #![feature(try_trait_v2_yeet)]

This is a tracking issue for standard library additions related to #96373, which for now means the ops::Yeet struct and related impls.

It currently exists experimentally. Per the lang process, this cannot go further than experimenting without an approved RFC -- and will certainly not stabilize under the name Yeet. Please try this out and give experience reports, but be aware that it may well change drastically or be removed entirely.

Public API

// core::ops
pub struct Yeet<E>(pub E);

impl<T> ops::FromResidual<ops::Yeet<()>> for Option<T>;
impl<T, E, F: From<E>> ops::FromResidual<ops::Yeet<E>> for Result<T, F>;

Steps / History

Unresolved Questions

  • The name, of course.
@scottmcm scottmcm added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. labels Apr 25, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue May 1, 2022
Add `do yeet` expressions to allow experimentation in nightly

Two main goals for this:
- Ensure that trait restructuring in rust-lang#84277 (comment) doesn't accidentally close us off from the possibility of doing this in future, as sketched in https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#possibilities-for-yeet
- Experiment with the *existence* of syntax for this, to be able to weight the syntax-vs-library tradeoffs better than we can right now.  Notably the syntax (with `do`) and name in this PR are not intended as candidates for stabilization, but they make a good v0 PR for adding this with minimal impact to compiler maintenance or priming one possible name choice over another.

r? `@oli-obk`
The lang `second` for doing this: rust-lang/lang-team#160 (comment)

Tracking issues
- Lang, rust-lang#96373
- Libs-api, rust-lang#96374
@pro465

This comment was marked as spam.

@VixieTSQ
Copy link

As much as I love the name yeet, and I would not be mad if it gets stabilized as yeet, the name should probably be throw, or if we must be different then the anyhow crate already has a cool name: bail. In that case I'm not sure what the catch counterpart would be named. But those are the two names I'm putting on the table.

@AndyGozas
Copy link

I really don't think that the name should be any different from what it is in most other languages. If throw is changed to yeet then the only next step would be to use yoink instead of catch when that keyword comes up, but naming more and more things with what's essentially slang terms, raises the entry bar for the Rust language, especially for those who don't use English as their first language. Words like throw and catch are already known by many developers, and are simple enough even for those who are minimally experienced in English.

@heavyrain266
Copy link

heavyrain266 commented Jul 3, 2022

The word yeet surely looks "funny", but please be real because if we don't want some mainstream keywords like throw, what about toss? You can say "Hey, rustc toss an error here.", which sounds natural.

Personally, using slang words in programming language feels really unprofessional. Perhaps it makes sense to be used in some esolangs but not in the language used by mostly mature (as in age) community and big tech companies such as Mozilla, Twitter, Google, Microsoft and others.

@TheRawMeatball
Copy link

I think it should be either yeet or throw. If we're going to do something fun (which I'd personally support) it should be yeet given the community support it already has, and if not, we should stick to what is already pretty much the standard and go with throw.

@dnsco
Copy link

dnsco commented Jul 3, 2022

"Yeet" was chosen as a placeholder name to prevent bike-shedding and make room for implementation unhindered.

My understanding is that there will be a time to voice what you think the keyword should be, but for now, let's yeet those lines of inquiry.

@VixieTSQ
Copy link

VixieTSQ commented Jul 3, 2022

"Yeet" was chosen as a placeholder name to prevent bike-shedding and make room for implementation unhindered.

And yet there appears to be a lot of bike-shedding.. I think it backfired...

@Shfty
Copy link

Shfty commented Jul 4, 2022

"Yeet" was chosen as a placeholder name to prevent bike-shedding and make room for implementation unhindered.

With the unfortunate side-effect of planting a highly noticeable name - and accompanying link to this issue - in the std::ops documentation, which practically begs the reader to click on it and ask why on earth meme-tier keywords are appearing in experimental.

It's reassuring to see "at the very least it will not stabilize under the name Yeet" in the description, but it's an unnecessary distraction from whatever promped the aforementioned docs.rs browsing to begin with.

@dpc
Copy link
Contributor

dpc commented Jul 4, 2022

"Yeet" was chosen as a placeholder name to prevent bike-shedding and make room for implementation unhindered.

I think it was chosen, so work can be done before bikesheding ends. Bikesheding itself is unavoidable.

@toadslop
Copy link

toadslop commented Sep 12, 2022

"Yeet" was chosen as a placeholder name to prevent bike-shedding and make room for implementation unhindered.

I think what was meant was that the author didn't want to bikeshed, so it was named the first thing that came to mind. Perhaps the thought that giving it that name would mean that the main thing someone who doesn't know much about the implementation or what it's for would be able to do nothing but bike-shed the name. And would happily do so.

workingjubilee pushed a commit to tcdi/postgrestd that referenced this issue Sep 15, 2022
Add `do yeet` expressions to allow experimentation in nightly

Two main goals for this:
- Ensure that trait restructuring in rust-lang/rust#84277 (comment) doesn't accidentally close us off from the possibility of doing this in future, as sketched in https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#possibilities-for-yeet
- Experiment with the *existence* of syntax for this, to be able to weight the syntax-vs-library tradeoffs better than we can right now.  Notably the syntax (with `do`) and name in this PR are not intended as candidates for stabilization, but they make a good v0 PR for adding this with minimal impact to compiler maintenance or priming one possible name choice over another.

r? `@oli-obk`
The lang `second` for doing this: rust-lang/lang-team#160 (comment)

Tracking issues
- Lang, rust-lang/rust#96373
- Libs-api, rust-lang/rust#96374
@yoshiyahoo
Copy link

yoshiyahoo commented Dec 2, 2022

I'm not sure about this being a feature. The question mark operator signals the intent to return well enough, and while using the Err variant is more verbose, I think it's a decent enough way to handle errors. If this feature was to ever be added however, I would use the yeet keyword since it's more fun.

@nyabinary
Copy link

When are we stabilizing the yeet keyword :P

@gorentbarak

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests