8 ms·
Rustc: Add do yeet expressions to allow experimentation in nightly
- wonderbore 4y agoNext RFC: replace true/false with nocap/cap
- blindseer 4y agoAnd `unsafe` with `yolo`.
- collegeburner 4y ago`sus` fits with unsafe better I think.
- gpderetta 4y agoalso three letter shorter, so a definite improvement.
- viraptor 4y agoThis is getting into Lolcode territory. I HAZ A var ITZ A BUKKIT OF YARN
- Tuna-Fish 4y agoCurrently the term "unsafe" is overloaded, as both the keyword used to mark definitions of things that require manual verification, and as the keyword used to mark a block to acknowledge that such verification has been done. The correct approach is obviously to separate these two terms, and use "sus" to mark items that require verification, and "yolo" to mark that such verification has been done. Or: sus fn dangerous() { ... } yolo { dangerous() } // can only call dangerous inside a yolo block
- blindseer 4y agopog
- collegeburner 4y agoChange panic! to yikes! when?
- sundarurfriend 4y agopanic! should just become Panik
- bitwize 4y ago'unsafe' should be 'problematic'
- UncleEntity 4y agoor ‘prophylactic’…
- atoav 4y agoif/else with consider/tho
- monkeybutton 4y agoassert with fr
- fhakker 4y agoI do not think we can trust a computer to decide whether something is true or false. These kinds of august deliberations are best left to the new Disinformation Governance Board!
- jeroenhd 4y agoAll programs contain bugs and cosmic rays can flip bits at any time so it's nonsensical to trust boolean expressions. Therefore we should rename true/false to likely/unlikely.
- wonderbore 4y agoliterally/idk
- girvo 4y agoOh man that's amusing -- I'm not up on Rust internals, but it seems like it's used a funny test case for some other compiler ability?
- duskwuff 4y ago"yeet" is being used as a placeholder for a keyword which will rethrow errors to a caller. It probably won't actually be called "yeet"; they're just using a deliberately silly keyword to keep discussion focused on the functionality. https://areweyeetyet.rs/ https://areweyeetyet.rs/
- radarsat1 4y agoI mean.. "rethrow" sounds fine?
- heinrich5991 4y agoYour comment demonstrates why they chose "yeet". People start discussing the name before the feature, and choosing a name that is obviously not the final one lets them say "look, you don't have to discuss this yet".
- School-Cotton 4y agoWell, if they wanted people not to discuss the name, picking a polarizing, very distinctive, extremely annoying name is about the worst thing they could have done, even as a temporary placeholder.
- fhars 4y agoThey haven't even decided if this should be a language feature at all, an you are already bikeshedding the name...
- rocqua 4y agoBikeshedding from the outside is fine. As long as actual decision makers and productive project members aren't participating, bikeshedding can even be fun.
- ChrisSD 4y agoNote that this is a serious language proposal, but with a funny placeholder name so as to avoid bikeshedding until the feature is ready.
- golergka 4y agoRust seem to be doing a lot of things right not only from language design or memory safety, but also from project management perspective.
- dgb23 4y agoWould be fun if they'd stick with it regardless.
- littlestymaar 4y agoThat's exactly what happened to Linux Mint's Warpinator the name was purposely chosen to be stupid as a temporary placeholder, and then they ended up sticking with it.
- MawKKe 4y agonothing is more permanent than a temporary solution
- monkeybutton 4y agoI wonder what's going to happen with dark matter and dark energy once physicists have it figured out. They'll give the discoveries proper names followed by media and pop culture using "Dark X" for the next few decades?
- jeroenhd 4y agoIn Rust, macro calls end in an exclamation mark (println!, try!). Even if the Rust devs pick throw as a keyword, I'm 100% sure someone will write a macro that will allow you to write yeet! instead. I'm 66% sure that this macro will end up being included in the dependency chain of a common framework as well…
- 4y ago
- sph 4y agoFor the elders: https://www.urbandictionary.com/define.php?term=Yeet https://www.urbandictionary.com/define.php?term=Yeet
- deleted 4y ago[deleted]
- __ryan__ 4y ago> yeet is a bikeshed-avoidance name for throw/fail/raise/etc, used because it definitely won't be the final keyword. …and JavaScript will never be used for more than animating basic hypertext documents.
- dathinab 4y agoYou can't be sure how people will abuse. You can be sure this is not the final keyword. 1. It's only in nightly and needs a feature gate to be enabled, as such accidental usage is impossible and it's not usable at all for most projects (which require stable compatibility). 2. It will be removed in the future there is absolutely no stability guarantees for nightly unstable features, they might literally be gone in the next hour. If you abuse it no one care that you project brakes, the ecosystem knows that and as such stays away from nightly features outside of experimenting (and some unusual target support, like recompiling std with different options for using threads in WASM). Or in other words it's a very very different situation then unstable JS features which always where a mess you easily could accidentally use and in practice (CSS prefix) had to use all the time. Any feature gated nightly unstable things is better seen as an experimental fork of the compiler which is slightly easier to use then an actual fork.
- __ryan__ 4y agoYes, I’m mostly teasing. That said, you can’t guarantee that “yeet” won’t grow on the community though :-)
- hatesinterviews 4y agoI think some of the complaints about the permanence of temporary solutions are unwarranted in this case. This is only for the nightly branch of the compiler. Most Rust users run the stable compiler[1] (a different build) which is wholly incapable of using this feature. There are definitely niche features that languish in nightly for years, but this initiative to improve the Try trait and ? operator will have broad appeal and I imagine a good number of people willing to push forward to get it stabilized, at which point they will finally decide on the proper name. [1]: https://blog.rust-lang.org/2020/12/16/rust-survey-2020.html https://blog.rust-lang.org/2020/12/16/rust-survey-2020.html
- miav 4y agoYeet is only a placeholder for avoiding bikeshedding (https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#possibilities-for-yeet https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#poss...), but I do wonder if having it as the final keyword would in fact be a net negative. Sure, some people won't know the meaning of the word, but I'd argue that "raise" or "throw" meaning "propagate the previously caught error" is not obvious either, we're simply used to it. And it would take no time at all to infer from context/look up and it would be easy to remember. The biggest potential downside I can think of is opening the floodgates for adding more memey words to the language which could indeed be harmful. But I do think that having a quirky keyword like this could be a great benefit and not just in the "relating to them kids" sense. In my experience, the biggest obstacle to entering technical fields (a more relevant subtype of this is learning complex programming languages, such as Rust) is, for most people, not the lack of intelligence or resources, but rather the feeling that the insiders of those fields are in a different "category" of people. This is especially evident in interactions with PhDs. Even smart people, who have themselves successfully studied the fields in question at some point in their lives, upon finding out that someone has a PhD cease all attempts of analyzing what the PhD is saying and just nod along, as if the degree is an impenetrable intellectual barrier. In spite of being a decent programmer, it took me a long time to start reading computer science papers. Not because they were too complicated or I lacked context, but because the intentionally the language used made the work appear alien. And including even just a bit of spontaneous humanity can completely break this perception. I find this especially effective in textbooks. All of the textbooks I found most useful added many humorous tidbits. The purpose of those was not to have the amusement counteract boredom, the topics were fascinating by themselves, but rather to demonstrate to the reader that the author is in fact an individual of the same species. This is important, because such connection cannot be established if the book restricts itself solely to its main topic. The author is infinitely more knowledgeable than the reader in the relevant field (otherwise the reader would have no use for the textbook), so this demonstration of equality must come from elsewhere.
- Filligree 4y agoI guess I’m not tuned in enough, because I don’t understand the proposal. How does this improve on (?)?
- cjg 4y agoyeet e would be equivalent to return Err(e)
- Tuna-Fish 4y agoIt's a bunch of syntax sugar. The proposal is that instead of typing this: fn foo(b : bool) -> Result<Bar,Baz> { ... return Ok(bar); ... return Err(baz); } you can type: fn foo() -> Bar throws Baz { ... return bar; ... throw baz; //or yeet, in this proposal } and it works exactly identically as the first example. ? still works inside the function just as it normally would. I find the proposal sort of pointless, but also totally harmless, so why not.
- CryZe 4y agoThat's not all it does. It "breaks" to the nearest "try" barrier. It's basically the desugaring of the Err branch in the ? operator, that you can't currently express yourself. It's mostly relevant for try blocks. I guess you'd most commonly see this in "control flow like" macros that are similar to the ? operator, like various assertion macros that want to "yeet" an error in case the assertion fails (instead of panicking like those in std). So in a sense it actually is very similar to `throw` in traditional languages, as it can be caught inside the same function and isn't forced to `return` the error outside the function.