News for hackers. Stuff that matters.
Re:Rustc: Add do yeet expressions to allow experimentation i... by ChrisSD on Friday May 06, 2022 @12:45AM (#31281412)
Note that this is a serious language proposal, but with a funny placeholder name so as to avoid bikeshedding until the feature is ready.
Re:Rustc: Add do yeet expressions to allow experimentation i... by JoshTriplett on Friday May 06, 2022 @04:52AM (#31282935)
Exactly. We have general agreement that we want this feature, and several different opinions on what it should or shouldn't be called, and we wanted to enable experimentation without blocking on the naming discussion. (We'll have to have that discussion at some point.)
Re:Rustc: Add do yeet expressions to allow experimentation i... by golergka on Friday May 06, 2022 @02:55AM (#31282115)
Rust seem to be doing a lot of things right not only from language design or memory safety, but also from project management perspective.
Re:Rustc: Add do yeet expressions to allow experimentation i... by dgb23 on Friday May 06, 2022 @03:04AM (#31282188)
Would be fun if they'd stick with it regardless.
Re:Rustc: Add do yeet expressions to allow experimentation i... by jeroenhd on Friday May 06, 2022 @08:24AM (#31284310)
In 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…

Re:Rustc: Add do yeet expressions to allow experimentation i... by littlestymaar on Friday May 06, 2022 @04:28AM (#31282780)
That'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.
Re:Rustc: Add do yeet expressions to allow experimentation i... by MawKKe on Friday May 06, 2022 @07:40AM (#31283952)
nothing is more permanent than a temporary solution
Re:Rustc: Add do yeet expressions to allow experimentation i... by monkeybutton on Friday May 06, 2022 @07:56AM (#31284080)
I 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?
Re:Rustc: Add do yeet expressions to allow experimentation i... by umanwizard on Friday May 06, 2022 @09:53AM (#31285098)
No it wouldn’t. I use rust for work which is frustrating enough without jokey meme bullshit.

One of the most obnoxious things is people forcing other people to partake in their own sense of humor.

Re:Rustc: Add do yeet expressions to allow experimentation i... by dathinab on Friday May 06, 2022 @09:38AM (#31284921)
It also massively reduce the risk of ofissication as with "yeet" it's pretty clear that you code will brake in the future ;)
Re:Rustc: Add do yeet expressions to allow experimentation i... by umanwizard on Friday May 06, 2022 @09:52AM (#31285086)
It’s not a funny placeholder name, it’s an annoying and extremely cringey placeholder name.
Re:Rustc: Add do yeet expressions to allow experimentation i... by throwaway894345 on Friday May 06, 2022 @10:07AM (#31285265)
They thought a placeholder name would stop you from bikeshedding? You showed them.
Re:Rustc: Add do yeet expressions to allow experimentation i... by umanwizard on Friday May 06, 2022 @10:19AM (#31285421)
Indeed.
Re:Rustc: Add do yeet expressions to allow experimentation i... by rgrmrts on Friday May 06, 2022 @11:04AM (#31286012)
“cringe” is a separate expression analogous to panic but only used inside unsafe blocks and does not halt execution
Re:Rustc: Add do yeet expressions to allow experimentation i... by smoldesu on Friday May 06, 2022 @10:06AM (#31285253)
I don't think they meant funny as in "it made me laugh", but more like "it was intended to not be taken seriously"
Re:Rustc: Add do yeet expressions to allow experimentation i... by hatesinterviews on Friday May 06, 2022 @08:46AM (#31284474)
I 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

Re:Rustc: Add do yeet expressions to allow experimentation i... by miav on Friday May 06, 2022 @09:06AM (#31284647)
Yeet is only a placeholder for avoiding bikeshedding (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.

Re:Rustc: Add do yeet expressions to allow experimentation i... by __ryan__ on Friday May 06, 2022 @07:22AM (#31283825)
> 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.

Re:Rustc: Add do yeet expressions to allow experimentation i... by dathinab on Friday May 06, 2022 @09:37AM (#31284909)
You 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.

Re:Rustc: Add do yeet expressions to allow experimentation i... by __ryan__ on Friday May 06, 2022 @10:41AM (#31285696)
Yes, I’m mostly teasing. That said, you can’t guarantee that “yeet” won’t grow on the community though :-)
Re:Rustc: Add do yeet expressions to allow experimentation i... by wonderbore on Friday May 06, 2022 @12:21AM (#31281285)
Next RFC: replace true/false with nocap/cap
Re:Rustc: Add do yeet expressions to allow experimentation i... by blindseer on Friday May 06, 2022 @12:28AM (#31281321)
And `unsafe` with `yolo`.
Re:Rustc: Add do yeet expressions to allow experimentation i... by collegeburner on Friday May 06, 2022 @12:41AM (#31281388)
`sus` fits with unsafe better I think.
Re:Rustc: Add do yeet expressions to allow experimentation i... by Tuna-Fish on Friday May 06, 2022 @09:05AM (#31284634)
Currently 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
Re:Rustc: Add do yeet expressions to allow experimentation i... by blindseer on Friday May 06, 2022 @11:45AM (#31286527)
pog
Re:Rustc: Add do yeet expressions to allow experimentation i... by viraptor on Friday May 06, 2022 @08:12AM (#31284228)
This is getting into Lolcode territory.

I HAZ A var ITZ A BUKKIT OF YARN

Re:Rustc: Add do yeet expressions to allow experimentation i... by gpderetta on Friday May 06, 2022 @06:37AM (#31283587)
also three letter shorter, so a definite improvement.
Re:Rustc: Add do yeet expressions to allow experimentation i... by collegeburner on Friday May 06, 2022 @12:44AM (#31281401)
Change panic! to yikes! when?
Re:Rustc: Add do yeet expressions to allow experimentation i... by sundarurfriend on Friday May 06, 2022 @05:10AM (#31283022)
panic! should just become Panik
Re:Rustc: Add do yeet expressions to allow experimentation i... by bitwize on Friday May 06, 2022 @08:13AM (#31284233)
'unsafe' should be 'problematic'
Re:Rustc: Add do yeet expressions to allow experimentation i... by UncleEntity on Friday May 06, 2022 @08:19AM (#31284281)
or ‘prophylactic’…
Re:Rustc: Add do yeet expressions to allow experimentation i... by atoav on Friday May 06, 2022 @03:36AM (#31282408)
if/else with consider/tho
Re:Rustc: Add do yeet expressions to allow experimentation i... by monkeybutton on Friday May 06, 2022 @07:57AM (#31284099)
assert with fr
Re:Rustc: Add do yeet expressions to allow experimentation i... by fhakker on Friday May 06, 2022 @05:39AM (#31283213)
I 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!
Re:Rustc: Add do yeet expressions to allow experimentation i... by jeroenhd on Friday May 06, 2022 @08:17AM (#31284270)
All 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.
Re:Rustc: Add do yeet expressions to allow experimentation i... by wonderbore on Friday May 06, 2022 @06:58PM (#31290412)
literally/idk
Re:Rustc: Add do yeet expressions to allow experimentation i... by sph on Friday May 06, 2022 @03:52AM (#31282532)
Re:Rustc: Add do yeet expressions to allow experimentation i... by Filligree on Friday May 06, 2022 @09:09AM (#31284675)
I guess I’m not tuned in enough, because I don’t understand the proposal.

How does this improve on (?)?

Re:Rustc: Add do yeet expressions to allow experimentation i... by Tuna-Fish on Friday May 06, 2022 @12:27PM (#31287047)
It'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.
Re:Rustc: Add do yeet expressions to allow experimentation i... by CryZe on Friday May 06, 2022 @02:46PM (#31288496)
That'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.

Re:Rustc: Add do yeet expressions to allow experimentation i... by cjg on Friday May 06, 2022 @09:48AM (#31285041)
yeet e would be equivalent to return Err(e)
Re:Rustc: Add do yeet expressions to allow experimentation i... by girvo on Friday May 06, 2022 @12:34AM (#31281360)
Oh 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?
Re:Rustc: Add do yeet expressions to allow experimentation i... by duskwuff on Friday May 06, 2022 @12:50AM (#31281426)
"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/

Re:Rustc: Add do yeet expressions to allow experimentation i... by cormacrelf on Friday May 06, 2022 @04:50AM (#31282923)
I’m puzzled as to why this PR used “do yeet” and not just “yeet”. Are they bikeshed-avoiding the bikeshed-avoidance because just “yeet” would actually be ergonomic and fun and therefore become a candidate if not deliberately sabotaged? Was “yeet” too credible? Is this admission paving the way for actually using “yeet” as the final syntax later? This drama and more, nightly at 7pm.
Re:Rustc: Add do yeet expressions to allow experimentation i... by the8472 on Friday May 06, 2022 @04:58AM (#31282964)
`do` already was a reserved keyword, so it doesn't cause any conflicts with identifiers when parsing
Re:Rustc: Add do yeet expressions to allow experimentation i... by dathinab on Friday May 06, 2022 @09:43AM (#31284981)
> probably

Pretty much guaranteed, as "do yeet" is also rather long. Likely some new edition introduced keyword/syntax or similar will be used.

Also while yeet is "fun" very few want to see it in the language for real ;)

Re:Rustc: Add do yeet expressions to allow experimentation i... by felurx on Friday May 06, 2022 @08:48AM (#31284493)
"yeet is for the people" is a wonderful quote from that page.
Re:Rustc: Add do yeet expressions to allow experimentation i... by radarsat1 on Friday May 06, 2022 @02:42AM (#31282023)
I mean.. "rethrow" sounds fine?
Re:Rustc: Add do yeet expressions to allow experimentation i... by heinrich5991 on Friday May 06, 2022 @03:44AM (#31282464)
Your 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".
Re:Rustc: Add do yeet expressions to allow experimentation i... by umanwizard on Friday May 06, 2022 @09:56AM (#31285124)
Well, 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.
Re:Rustc: Add do yeet expressions to allow experimentation i... by efaref on Friday May 06, 2022 @07:41AM (#31283963)
It's not necessarily a "re-"throw. It could just be a throw of a newly detected error, like:

    try {
        if bad_thing {
            do yeet Error::new(...);
        }
        carry_on()
    }
Just plain "throw" would probably be fine, but I understand not wanting to bikeshed it at this stage.

Weirdly, "yeet" really does convey the sense of "just give up and chuck this thing back instead" that makes it a reasonable nice converse of "try", i.e. "try { yeet }".

Re:Rustc: Add do yeet expressions to allow experimentation i... by fhars on Friday May 06, 2022 @03:17AM (#31282292)
They haven't even decided if this should be a language feature at all, an you are already bikeshedding the name...
Re:Rustc: Add do yeet expressions to allow experimentation i... by rocqua on Friday May 06, 2022 @03:44AM (#31282465)
Bikeshedding from the outside is fine. As long as actual decision makers and productive project members aren't participating, bikeshedding can even be fun.
Re:Rustc: Add do yeet expressions to allow experimentation i... by themulticaster on Friday May 06, 2022 @05:58AM (#31283351)
Be careful with that - some Rust team members are active around HN [1], some are even participating in the comment section for this post. So I guess we need to exclude them from the outsider-exclusive bikeshedding event.

I agree, bikeshedding can be fun, as long as it's not during a meeting.

[1] Steve Klabnik, I know you're going to see this - just wanted to say hi, I hope you're having a nice day :)

Re:Rustc: Add do yeet expressions to allow experimentation i... by steveklabnik on Friday May 06, 2022 @12:37PM (#31287159)
I'm doing okay, thanks! I'm not on any Rust teams, anymore, though.

There are some other folks around so your point isn't incorrect, only about me.

Re:Rustc: Add do yeet expressions to allow experimentation i... by sgtnoodle on Friday May 06, 2022 @04:09AM (#31282640)
It's not really my place to warn you since it's not my problem, but I take exception to your assertion that the poster is in error. I think we should raise the bar, and check ourselves when being too critical. Try not to panic when other folk throw out ideas, even when you find fault in them. I didn't expect this to be a political topic, unlike abortion the last few days. Yeetsh!

I've been recently working on a new system that involves a custom IDL. We ended up adding a "[<=]" syntax, but we were worried it would be confusing to new developers. We realized it would make people happy to have an excuse to type smiley faces, though.

Re:Rustc: Add do yeet expressions to allow experimentation i... by sgtnoodle on Saturday May 07, 2022 @04:19AM (#31292975)
I guess folk here don't like puns.
Re:Rustc: Add do yeet expressions to allow experimentation i... by dathinab on Friday May 06, 2022 @09:49AM (#31285054)
Bikeshedding is a major pain for developing in large projects.

Naming bikeshedding is one of the worst kind of bikeshedding.

By now I'm sure of two things:

- People will not agree on a name.

- People will diverge any technical discussion again and again and again because they need to discuss naming.

So in the end most likely there will be some formal or informal survey and then the language teem will do a top-down decisions for one of the more well liked candidates, it's as far as I can tell pretty much the best way to go. (Theoretically you could have a vote, but then you need a proper not easily manipulated voting system people need to take serious, or it will be named not yeet in the end because people are trolls).

EDIT: Also this is not a developer discussion so I guess it's fine here ;)

Re:Rustc: Add do yeet expressions to allow experimentation i... by TheCycoONE on Friday May 06, 2022 @06:04PM (#31290038)
Oh, if we're bike shedding I propose ¿ as the natural syntax (because it jumps to ?.) /s
Re:Rustc: Add do yeet expressions to allow experimentation i... by oxff on Friday May 06, 2022 @04:17AM (#31282690)
leaving it as yeet sounds fine to me honestly