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.
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?
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.
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).
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.
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.
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.
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.
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). ↩︎
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
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.
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).