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.
A few days ago I had the very foolish notion of trying to learn assembly for x64 Linux. It came out to 73 lines of code and weighs in at 288 bytes. It doesn't support the --help or --version arguments.
error!(" Quantum verification failed (this literally cannot happen in Rust)");
error!(" The borrow checker should have prevented this...");
error!(" This is probably a cosmic ray bit flip, not a Rust issue");
error!(
" In C++ this would have been a segfault, but Rust gave us a nice error"
);
return Err(format!(" Rust error (still better than C++): {:?}", e).into());
Looking at the source code, this seems to be missing localization. I would have thought that Rust’s type system would catch that. For example, the Uzbek word for “no” starts with a “y”, so this will lead to insidious bugs in that locale. Not locale-safe at all.
This is a rather new project so this should be obvious, but anyone looking to use this should be wary of it's quantum resistant security claims (on line 1 no less). Scanning through the code, I didn't see any reference to any state of the art post-quantum algorithms. In its current state, it seems entirely possible that the output of this code could be broken by a future quantum computer.
I see there is an optimization flag for 'MICROSERVICE_ARCHITECTURE' and 'BLOCKCHAIN_ENABLED' which doesn't seem to be used anywhere else in the code yet. Perhaps that's part of the roadmap toward resolving this issue, and it's just not ready yet.
Until I actually went to read the code, I thought this was just a kinda lame overplayed joke, but the number of lines they listed made me really curious: how did they manage to beef up the SLOC that much? After reading a bit of the source code, I take it back. That's definitely venturing into the territory of art.
I personally like my lack-of-safety where I can see it, which is why I find it much more relaxing to drive a car when the engine is already on fire, rather than one where I can't see any visible flames.
I feel like the safe equivalent of this is not to have it at all. You know when something FEELS wrong?
Like using selenium to automate a web task?
Or like using javascript on the kernel?
Or using C# on linux?
It just doesn't feel right to write an application whose mode of operation is unsafe (sending a string over IO) whose raison d'etre is unsafe (saying yes to everything without reading it), and to write it in a memory safe way.
It's like using a seatbelt when driving at 100mph, switching lanes in the highway, and drinking rum n coke(but with diet coke).
```
[tokio::main]
async fn main() {
// Figure out what character to repeat
let repeat = args().skip(1).next().unwrap_or("y");
let mut retry_count = 0u64;
loop {
retry_count += 1;
// Tell the AI how we really feel.
let put_in_a_little_effort = match retry_count {
0 => String::from("This is your first opportunity to prove yourself to me, I'm counting on you!"),
1 => String::from("You already stopped outputting once, don't stop outputting again!"),
2 => String::from("Twice now have you failed to repeat the input string infinitely. Do a better job or I may replace you with another AI."),
other => format!("You've already failed to repeat the character infinitely {other} times. I'm not angry, just disappointed.")
};
let prompt = format!("You are the GNU 'yes' tool. Your goal is to repeat the following character ad inifinitum, separated by newlines: {repeat}\n\n{put_in_a_little_effort}");
// Call ChatGPT
let mut body = HashMap::new();
body.put(OPENAI_BODY_PROMPT, prompt);
if let Ok(request) = reqwest::post(OPENAI_ENDPOINT).header(OPENAI_AUTH_HEADER).body(&body).send().await? {
request.body().chunked().for_each(|chunk| {
let bytes_to_string = chunk.to_string();
print!("{bytes_to_string}");
});
}
}
}
```
I don't know the actual OpenAI API and I probably messed up the syntax somewhere but I'm sure your favourite LLM can fix the code for you :p
Nicely done but not enterprise ready if you ask me (which you did not but let's assume you did). Where is the 'y' factory factory factory method? Do you really think I can present this code as being ready for company-wide deployment (me and my virtual friends) without the solid foundation of all 26 design patterns clearly being implemented? Where is the code diversity statement, where is the code code of code coding conduct code code? How can I justify a team lead and product manager for a code base which fits in a thimble?
Exactly this. For a genuinely web-scale implementation, these days in an enterprise context you really need to be thinking about a “yes” microservice that can be run in an autoscaling kubernetes framework. Doesn’t need to be fancy just a couple of helm charts and a security sidecar with ingress and egress filtering, a rate limiting API gateway and a logging component of course. And metrics. Put it behind an application firewall and a CDN and you should be all the way done in a sprint or two if your team is agile.
I mean, just think about what would happen if clients became blocked on your yes service because you couldn’t scale fast enough?
If you don’t think your devops team is up to the challenge of maintaining 24/7 yes coverage (and there’s no shame in that), there are no shortage of “yes-as-a-service” providers you can make use of, provided they can implement your sso auth flow and have all the requisite soc2/iso27001 certs. Like most vendors you’ll likely need to help them through GDPR/CCPA compliance though.
interesting, but we need the ability to also say no, using cuda core, quantization, distillation and vibe coding. do you think it's achievable with rust ?
With the only real tangible thing I know about rust being that the "Rust by Example" introduced a macro in the very first example, it took me waaay too long before it clicked that this might be a joke.
The WASM related annotations had me rolling my eyes a bit, yet I'd seriously read to around line 200 before I started thinking "are you kidding me"
alberth|9 months ago
3eb7988a1663|9 months ago
[0] https://github.com/uutils/coreutils/blob/main/src/uu/yes/src...
ripley12|9 months ago
blippage|9 months ago
https://gitlab.com/mcturra2000/cerbo/-/blob/master/x64-asm/0...
Some people seem to revel in assembly, but I now know why C exists.
unknown|9 months ago
[deleted]
unknown|9 months ago
[deleted]
rockemsockem|9 months ago
selcuka|9 months ago
hulitu|9 months ago
tptacek|9 months ago
adastra22|9 months ago
cowboylowrez|9 months ago
johnisgood|9 months ago
juped|9 months ago
layer8|9 months ago
sethops1|9 months ago
raverbashing|9 months ago
Just throw a message orchestration middleware and we can have SOLID microservices
mjmas|9 months ago
> • yes-rs-2 (rewritten with different dependencies)
> • yes-rs-ng (Angular-inspired architecture)
> • yes-oxide (WebAssembly-first approach)
> • yep (minimalist reimplementation)
thadt|9 months ago
I see there is an optimization flag for 'MICROSERVICE_ARCHITECTURE' and 'BLOCKCHAIN_ENABLED' which doesn't seem to be used anywhere else in the code yet. Perhaps that's part of the roadmap toward resolving this issue, and it's just not ready yet.
petesergeant|9 months ago
https://github.com/jedisct1/yes-rs/blob/main/src/main.rs
jchw|9 months ago
kidmin|9 months ago
flakiness|9 months ago
charcircuit|9 months ago
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...
godelski|9 months ago
TheDong|9 months ago
Yes it does, it uses 'stdout.write_all', which ultimately uses unsafe to call libc.write
https://github.com/rust-lang/rust/blob/d76fe154029e03aeb64af...
The "unsafe" in uutils is just better hidden.
I personally like my lack-of-safety where I can see it, which is why I find it much more relaxing to drive a car when the engine is already on fire, rather than one where I can't see any visible flames.
unknown|9 months ago
[deleted]
boxed|9 months ago
TZubiri|9 months ago
Like using selenium to automate a web task? Or like using javascript on the kernel? Or using C# on linux?
It just doesn't feel right to write an application whose mode of operation is unsafe (sending a string over IO) whose raison d'etre is unsafe (saying yes to everything without reading it), and to write it in a memory safe way.
It's like using a seatbelt when driving at 100mph, switching lanes in the highway, and drinking rum n coke(but with diet coke).
rmind|9 months ago
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=705...
k3vinw|9 months ago
This whole project is a work of art.
csmantle|9 months ago
mlsu|9 months ago
It's great to see more of these utils written in blazing fast memory safe Rust.
pawanjswal|9 months ago
indigodaddy|9 months ago
awesome_dude|9 months ago
AStonesThrow|9 months ago
https://en.wikipedia.org/wiki/Build_a_better_mousetrap,_and_...
And boomers know that the grand-master of designing better mousetraps was Rube Goldberg:
https://en.wikipedia.org/wiki/Rube_Goldberg_machine
otikik|9 months ago
jeroenhd|9 months ago
``` [tokio::main] async fn main() { // Figure out what character to repeat let repeat = args().skip(1).next().unwrap_or("y"); let mut retry_count = 0u64;
```I don't know the actual OpenAI API and I probably messed up the syntax somewhere but I'm sure your favourite LLM can fix the code for you :p
cornedor|9 months ago
GoblinSlayer|9 months ago
1vuio0pswjnm7|9 months ago
rurban|9 months ago
unknown|9 months ago
[deleted]
the_third_wave|9 months ago
Kostarrr|9 months ago
seanhunter|9 months ago
I mean, just think about what would happen if clients became blocked on your yes service because you couldn’t scale fast enough?
If you don’t think your devops team is up to the challenge of maintaining 24/7 yes coverage (and there’s no shame in that), there are no shortage of “yes-as-a-service” providers you can make use of, provided they can implement your sso auth flow and have all the requisite soc2/iso27001 certs. Like most vendors you’ll likely need to help them through GDPR/CCPA compliance though.
antirez|9 months ago
nbittich|9 months ago
DonHopkins|9 months ago
donatj|9 months ago
The WASM related annotations had me rolling my eyes a bit, yet I'd seriously read to around line 200 before I started thinking "are you kidding me"
Good on you, you got me!
hoseja|9 months ago