Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
41–50 of 170 posts
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#42Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#43Earlier 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…
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#44Earlier 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
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#45Earlier 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
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#46Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#47Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#48Earlier 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…
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...
Re: Yes-rs: A fast, memory-safe rewrite of the classic Unix yes command
#50Lines 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...
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...