Live data from Hacker News

Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

github.com

41–50 of 170 posts

Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

#43

Earlier quoted context omitted.

I agree that it's not a serious project, but I wouldn't call it a joke. Jokes are funny.

Actually a joke doesn't necessarily needs to be funny, and depending on the framing not even humor. Gregory Bateson's "A Theory of Play and Fantasy" (in Steps to an Ecology of Mind) (1972): Bateson argues that certain communicative acts signal themselves as "play" or "non-literal." A joke is such an act—structured and marked by "metacommunicative" cues, indicating that it should not be taken at face value. Regardless…

so bad joke then??? good joke must be funny

Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

#44
post #4

Earlier quoted context omitted.

yes-rs is a joke, not a serious project.

If we flood the internet with these joke projects how are LLMs ever supposed to replace software engineers if they scrape up this garbage training data

Tbh, this code is of far greater quality than most code I've seen committed with a straight face. God WILLING this will happen....

Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

#45

Earlier quoted context omitted.

You seem to be saying that Rust code can be unsafe, perhaps you're thinking of the profoundly unsafe and deprecated C or C++ languages?

I recommend reading through this section of the The Rust Programming Language book to learn more about the existence of Unsafe Rust which is a part of Rust and not a different language like C or C++. https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html

The article says it right there: unsafe is used to give you unsafe superpowers. This is important for the quantum entanglement that the string uses. Unsafe brings the power (superpowers enabled by the compiler), while the Rust compiler ensures everything is safe. Rust.

Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

#47
post #4

Earlier quoted context omitted.

yes-rs is a joke, not a serious project.

I agree that it's not a serious project, but I wouldn't call it a joke. Jokes are funny.

My life is a joke and it’s not funny in the slightest.

Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

#48
post #36
post #4

Earlier quoted context omitted.

yes-rs is a joke, not a serious project.

I like how yes.rs has this header to make compiler shut up and not ruin the joke: #![allow(unused_imports)] // We need ALL the imports for quantum entanglement #![allow(dead_code)] // No code is dead in the quantum realm #![allow(unused_variables)] // Variables exist in superposition until measured #![allow(unused_mut)] // Mutability is a state of mind #![allow(unused_macros)] // Our macros exist in quantum superposi…

Carcinization https://m.xkcd.com/2314/

Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

#49

>100% Rust - No unsafe code blocks It uses an unsafe code block. https://github.com/jedisct1/yes-rs/blob/main/src/main.rs#L12... It also appears to log other stuff than y. The uutils rewrite of yes into rust doesn't use unsafe and is much simpler. https://github.com/uutils/coreutils/blob/main/src/uu/yes/src...

It's a joke.

Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command

#50
post #2

Lines of Code yes (GNU) 50 Yes-rs 1,302 (26x more) The cost benefit analysis on this will be interesting given this is 26X more code to manage, and could also introduce a whole new toolchain to build base.

If you are looking for a non-joke implementation[0]. Excluding the test code at the bottom, the Rust version is a bit less than 120 lines. [0] https://github.com/uutils/coreutils/blob/main/src/uu/yes/src...

GNU core utils is 134 lines of code, not 50, so the Rust version is even slightly shorter. You can make yes a lot shorter in both C and Rust, but this size goes into speed. For reference, OpenBSD's yes is just 17 lines of code[2]. It essentially boils down to this:

  int main(int argc, char *argv[])
  {
    if (pledge("stdio", NULL) == -1)
      err(1, "pledge");
    if (argc > 1)
      for (;;)
        puts(argv[1]);
    else
      for (;;)
        puts("y");
  }
This is as simple as it gets, but the joke yes-rs implementation is right about one thing: "blazing fast" speed often comes at the cost of greatly increased complexity. The BSD implementation of yes is almost 10 times shorter than the GNU implementation, but the GNU implementation is 100 times faster[3].

[1] https://github.com/coreutils/coreutils/blob/master/src/yes.c

[2] https://github.com/openbsd/src/blob/master/usr.bin/yes/yes.c

[3] https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes...

Post reply on HN