Some `yeet` bikeshedding, just for fun

All replies bikeshedding the name yeet are moved here from Why yeet in try blocks if break is good enough? in order not to overwhelm the original topic.

This is not the first time for yeet bikeshedding discussions, nor the last time, nor the intended time to bring the bikeshedding any closer to any official conclusions; thus this topic thread is also unlisted so that it wonʼt give off any wrong impressions for its unofficial and just-for-fun nature.

4 Likes

I like the name yeet. I wouldn't mind seeing that stabilised, it is a fun and a bit unexpected thing. Lightens the mood from the typical grey and boring professionalism. Fits right in with the rust community (which I perceive as more welcoming to individual expressions than most programming languages, both online and at events).

Just think about it, it would never in million years be named "yeet" in ISO C++, or Java. Is Rust brave enough to be different here? :wink:

6 Likes

I recommend this old post from niko:

If this was a fundamentally-new thing, then yeet might actually work. But I don't think it's different enough from things in other languages to be worth using a word different from what's already in people's heads anyway.

7 Likes

That is actually a good point. I always have to think when coding C++ and Python which language uses "except" and which uses "catch". Both are features i use somewhat rarely in both of those languages (even more so in C++, in Python it is hard to avoid dealing with exceptions).

1 Like

i think it would be needlessly confusing to stabilize yeet_expr under the name throw, as they are different things. the rust equivelent to throwing an exception is panic, and this is reflected in catch_unwind. throw implies nonlocal control flow, which yeet is not.

bail would be a decent name.

3 Likes

The main issue with bail is that it is already used in a lot of error handling crates and so making it a new keyword would be disruptive.

Despite being 'unserious' yeet is suprisingly good choise as it is not commonly used as an identifier and has no prior connections to exeptions.

So was try. One pattern we've been observing sometimes is that the crate ecosystem prototypes some great ideas, and they're successful enough that we want to put them in the language or standard library, and then we have the problem of either breaking those popular crates or using a less familiar or less ideal name for the concept.

Worst case, we have editions, and could introduce bail over an edition.

6 Likes

That's true from an implementation perspective, but I don't think that's the best criterion.

From a "what am I trying to do?" perspective, if in Python you'd raise InsufficientFundsError, the rust equivalent is not to panic_any(InsufficientFundsError), but to throw InsufficientFundsError.

6 Likes

FWIW I've been using a yeet! macro in some projects, expanding to return Err($e)?. In the projects large enough to justify it and my oops! helper macro, it has been very convenient to use.

Since I find it interesting and tangentially meaningful, YEET# will be allowed in international Scrabble tournaments[1] starting in 2025.


  1. International Scrabble uses the Collins word list, and # notates that a word is CSW exclusive; North American tournaments use the smaller NASPA word list (NWL). ↩︎

5 Likes

I'd argue that is not a direct equivalent. Like @binarycat, to me throw reads "nonlocal exception", that will be caught and handled anywhere up the call stack, whereas in Rust it will always only go to the immediate surrounding try or function block, and no further.

Since we are already bikeshedding, my vote would be for error (or even just err if we are lazy in typing), since Err results is what we are constructing:

let Ok(val) = validate(expression) else {
    error format!("{expression:?} is invalid!"); 
}

Not to mention it'd give me fuzzy, warm, nostalgic BASIC vibes :slight_smile:

1 Like

Actually using yeet as the keyword would come across as an extremely-ill advised attempt to appeal to young people the iPod generation using the hip and trendy memes of ereyesteryear. If yeet is ever seriously considered for stabilization, I'd like to counterpropose weorpan, which is equally unused as an identifier and equally up-to-date with current language trends.

4 Likes

This is probably false. While usage is certainly way down from peak meme, as a vague indicator, Google Trends shows yeet as being stable around 20% of its peak, nothing for weorpan, and yoink (what I believe more people would recognize as being a "legitimate" word, picked for being the best antonym of yeet IMHO) with a nonzero search interest that's no more than around 3% of yeet's.


Anyway, the use of yeet in the unstable syntax was to use a silly option with low likelihood of being the real choice, just to have something agreed on to be able to discuss the feature without going through endless bikeshed up front. I do agree it's a possible choice, but unless the purpose of a thread is to discuss the choice of syntax specifically, the use of yeet or or whatever should be understood as "placeholder for an appropriate keyword," not as an actual choice, until otherwise stated.

And yeah, inertia of being used on unstable (behind a do prefix) does lend some legitimacy to the choice that might not otherwise exist. But Rust's design isn't a popularity contest (nor a democracy nor republic), and the teams involved have the stated position that yeet is indeed just a placeholder, and syntax will be relitigated before stabilization (bare minimum FCP).

1 Like

I kind of want to learn how to write proc macros now.

So I could make a Ye Olde Ruſt novelty transformation pass. Never had the motivation before to learn proc macros.

1 Like