HNHacker News
TopNewBestAskShowJobs

mprovost

3,269 karma · joined May 26, 2007

Self-publishing "Rust From the Ground Up" on Leanpub.

https://rftgu.rs.

Contact me at m@termcap.net.

submissionscomments
mprovost··on D4D4
This reminds me of coding with AI where slightly changing the prompt gives you different code and you don't really understand why but you use it anyway. In this case it's not even the compiler that's adding the incorrect instructions - it's the linker. Someday we'll just trust the AI to spit out working code the same way we assume that the C toolchain produces reasonable assembler. And when it doesn't it's remarkable enough to warrant a blog post and HN discussion.
mprovost··on Vanishing from Hyundai’s data network
At least in the UK the Kia Niro comes in petrol, plug-in hybrid, and full EV versions of the same chassis. It seems like most Uber drivers in London have replaced their hybrid Prius with an EV Niro.
mprovost··on Fixing Ctrl+C in Rust terminal apps: Child process management
Yes well, the pipefail option configures bash to do the opposite of its usual behaviour.
mprovost··on OpenAI's ChatGPT Agent casually clicks through "I am not a robot" verification
They've updated the ReCaptcha website, but it used to say: "Every time our CAPTCHAs are solved, that human effort helps digitize text, annotate images, and build machine learning datasets."

https://web.archive.org/web/20140417093510/https://www.googl...

mprovost··on Fixing Ctrl+C in Rust terminal apps: Child process management
In other shells, the status of the pipeline is the exit status of the last process, so in this case that would be head which exits with 0.
mprovost··on OpenAI's ChatGPT Agent casually clicks through "I am not a robot" verification
Google at least uses captchas to gather training data for computer vision ML models. That's why they show pictures of stop lights and buses and motorcycles - so they can train self-driving cars.
mprovost··on Fixing Ctrl+C in Rust terminal apps: Child process management
Handling SIGINT (ctrl-c) with child processes is tricky, but a more pervasive problem for Rust CLI programs is handling SIGPIPE. For historical reasons the compiler adds a signal handler before calling main() which ignores SIGPIPE. It means when you pipe your Rust CLI program's output to something like head, instead of being killed by the signal sent when head closes the pipe, you get a write error and usually print an error message instead of silently dying. You can match on the type of write error and skip printing a message when it's from a broken pipe, but a more subtle problem is that the shell sets the exit status of a program killed by a signal to 128 + the signal number, so 141 in the case of a broken pipe. You can emulate this behaviour by checking for a broken pipe and explicitly exiting with a 141 status code, but it's not possible to fully reproduce being killed by a signal. There's been an issue to make this configurable (the latest proposal is via a compiler flag) for years.
mprovost··on Many lung cancers are now in nonsmokers
I expect that Americans spend more time in their basements than people in most other countries (other than Canada). The kind of furnished basement that teenagers hang out in from That 70's Show isn't common elsewhere.
mprovost··on lsr: ls with io_uring
Sure, at some point you have to let the abstraction leak. At the time Sun designed NFS, you could basically count on the fact that the server was some Solaris machine capable of multiple years of uptime on your LAN. Filesystems never made the transition to running over the internet because that was too unreliable and POSIX didn't really provide the right interfaces to expose that.

We're coming to the end of the road with that generation of OS design - MacOS is still Unix and thinks that it's running on a VAX. There's a reason why Macbooks don't come with a 5G modem: because programs would have to be aware of the underlying network. That's why it's inevitable that we'll move to something like IOS (or Android), because every program that uses the network has to handle not only failures but situations like being in flight mode or running on low-bandwidth mobile networks.

mprovost··on lsr: ls with io_uring
The designers of NFS chose to make a distributed system emulate a highly consistent and available system (a hard drive), which was (and is) a reasonable tradeoff. It didn't require every existing tool, such as ls, to deal with things like the server rebooting while listing a directory. (The original NFS protocol is stateless, so clients can survive server reboots.) What does vi do when the server hosting the file you're editing stop responding? None of these tools have that kind of error handling.

I don't know how io_uring solves this - does it return an error if the underlying NFS call times out? How long do you wait for a response before giving up and returning an error?

mprovost··on Show HN: VS Code extension to edit the filesystem like a text buffer
There's a long history of "directory editor" programs going back to (at least) 1974, which predates emacs. It's not surprising that there are many examples of convergent evolution.

https://invisible-island.net/ded/dating-dired.html

mprovost··on Random selection is necessary to create stable meritocratic institutions
Two relevant quotes from writers who could not be more different:

“I would rather be governed by the first 2,000 people in the Boston telephone directory than by the 2,000 faculty members of Harvard University.” - William F Buckley Jr

“Anyone who is capable of getting themselves made President should on no account be allowed to do the job.” - Douglas Adams

mprovost··on Rust CLI with Clap
Thanks that actually looks really good! Part of the challenge with some of the crates is that they're great for advanced use but there's so much magic going on with derive macros, which a new Rust programmer won't be familiar with. Most simple CLI programs don't even declare structs so you would have to take a detour to explain that first.
mprovost··on Rust CLI with Clap
Yes 4 has been out for a while but I was caught in the time when it went from v2 (2020) to v3 (2021) to v4 (2022). I made the mistake of rewriting all the chapters from using 2 to 3, which was quickly deprecated for 4.
mprovost··on Rust CLI with Clap
I chose clap as the argument parsing crate for my book on Rust CLI programming and it's been my biggest regret. Folk sometimes complain that Rust itself is a moving target but I haven't found that to be the case at all. On the other hand, clap has gone through several, incompatible major releases over the past few years. Unfortunately, in order to keep this forward momentum, it also starts deprecating things which means that I had to pin it to a quickly outdated version. If I ever go back and update the earlier chapters I'd pick a simpler, slower-moving library.

On the other hand, this situation is a great example of why keeping things like argument parsing out of the Rust standard library is such a good idea. It's much better to let the community gel around some crates which are able to iterate (and innovate) faster than something with strict backwards-compatibility requirements. Looking at the discussion here there's clearly not one way to solve this - there's no way that something as large and complex as clap has evolved into will ever become "standard".

mprovost··on Bill Atkinson: Polaroids Showing the Evolution of the Lisa GUI [video]
Bill Atkinson, inventor of Atkinson dithering!

https://en.wikipedia.org/wiki/Atkinson_dithering

mprovost··on Using Microsoft's New CLI Text Editor on Ubuntu
Yes, modern software terminals have to emulate how the control key operated on ancient hardware terminals because unix baked that behaviour in.
mprovost··on Using Microsoft's New CLI Text Editor on Ubuntu
Hmm my Lisp Machine has control, meta, super, and hyper but no alt!
mprovost··on Using Microsoft's New CLI Text Editor on Ubuntu
On terminals, the control key masked off the 6th and 7th bits of the 8-bit value sent by the letter key. That's a bitwise AND with octal 037, or in decimal subtracting 96 from the lower case key value. This happens in the terminal (or keyboard) itself, so the computer doesn't see it as two pressed keys, it just gets the masked value. In ASCII 'c' is 99 (decimal), so when modified with control is 3, ETX (end of text), which teletypes used to indicate the end of text. So unix shells reused that control character to terminate the current program with SIGINT. But every letter key maps to a control character at the start of the ASCII range, like 'g' maps to BEL for the bell, or 'h' maps to BS (backspace). '[' maps to ESC (escape) which is handy when Apple decides to move the escape key on their laptop keyboard.
mprovost··on Andrej Karpathy: Software in the era of AI [video]
You can disagree with his conclusions but I don't think his understanding of small models is up for debate. This is the person who created micrograd/makemore/nanoGPT and who has produced a ton of educational materials showing how to build small and local models.
mprovost··on Bzip2 crate switches from C to 100% Rust
Why the hate? It's a genuine question. When you rewrite something, you need to justify the effort somehow. The GNU coreutils started out as "the BSD utilities, but with the GPL!".
mprovost··on Bzip2 crate switches from C to 100% Rust
Bash isn't the Bourne shell (sh)! It's a replacement (Bourne Again Shell). But it's interesting that the replacement has become so entrenched that folk assume that it was the original.
mprovost··on Bzip2 crate switches from C to 100% Rust
The GNU utils were a replacement for the BSD utils which were a replacement for the original AT&T utils. Every replacement added new functionality and improvements, and every time someone complained that they didn't stick closer to the thing they replaced. Looking specifically at grep, there used to be new versions like egrep and fgrep that added functionalities beyond standard grep's, but those were eventually pulled into "standard" grep (GNU or BSD). If we stuck with standards we'd all still be using the Bourne shell. The GNU utilities have been around long enough that they feel like the standard now, but I'm glad that we're coming into a new phase of innovation in command-line utilities. And this didn't start with Rust - the new generation of search utilities started with ack (Perl) and then ag (C).
mprovost··on At Amazon, some coders say their jobs have begun to resemble warehouse work
I have a strong memory from the start of my career, when I had a job setting up Solaris systems and there was a whispered rumour that one of the senior admins could read core files. To the rest of us, they were just junk that the system created when a process crashed and that we had to find and delete to save disk space. In my mind I thought she could somehow open the files in an editor and "read" them, like something out of the Matrix. We had no idea that you could load them into a debugger which could parse them into something understandable.
mprovost··on Flattening Rust’s learning curve
One approach that I don't see often enough is to focus on learning a subset of the language first. For example, in my own book on Rust, I skip teaching lifetimes. It's not necessary to write functions with lifetimes to build quite a few fully functioning programs. The same with macros (although the fact that their signatures are opaque doesn't make it easy for beginners). On the other hand, I disagree with the advice to rely on copy() or clone() - it's better to learn about borrowing from the beginning since it's such a fundamental part of the language.
mprovost··on Old Timey Code and Old Timey Mono Fonts
Dotted zeros remind me of the BIOS screen on an old monochrome Compaq luggable. Good times.
mprovost··on Generative AI is not replacing jobs or hurting wages at all, say economists
For some applications it feels like half the signal of whether you're qualified is whether the CV is set in Computer Modern, ie was produced via LaTeX.
mprovost··on Bletchley code breaker Betty Webb dies aged 101
Apparently some computers still aren't able to crack the simplest encryption schemes.
mprovost··on Show HN: NoteUX – Fast and minimalist note-taking app
I found it! Section 48.3 "A Scratchpad on Your Screen" from the first edition.

https://web.deu.edu.tr/doc/oreily/unix/upt/ch48_03.htm

mprovost··on Show HN: NoteUX – Fast and minimalist note-taking app
Yes that's it: "cat > /dev/null". Or you can even skip running cat and just "> /dev/null". You exit by typing ctrl-d which sends an EOF (and then sends all the output to /dev/null!).
← PreviousPage 2 of 26Next →