Option
and error handling. (Or the more complex Result
, but itās easier to explain with Option
.)
@movq@www.uninformativ.de Is this much different to Goās error handling as values though really? š§š¤£š
Option
and error handling. (Or the more complex Result
, but itās easier to explain with Option
.)
@movq@www.uninformativ.de Is this much different to Goās error handling as values though really? š§š¤£š
@movq@www.uninformativ.de Agree! Good list š
(Of course, if weāre talking about a project youāre doing for a customer and the customer keeps asking for new stuff, then youāre never done, and you have to think ahead and expect changes. Is that what they mean? š¤)
Saw this on Mastodon:
https://racingbunny.com/@mookie/114718466149264471
18 rules of Software Engineering
- You will regret complexity when on-call
- Stop falling in love with your own code
- Everything is a trade-off. Thereās no ābestā 3. Every line of code you write is a liability 4. Document your decisions and designs
- Everyone hates code they didnāt write
- Donāt use unnecessary dependencies
- Coding standards prevent arguments
- Write meaningful commit messages
- Donāt ever stop learning new things
- Code reviews spread knowledge
- Always build for maintainability
- Ask for help when youāre stuck
- Fix root causes, not symptoms
- Software is never completed
- Estimates are not promises
- Ship early, iterate often
- Keep. It. Simple.
Solid list, even though 14 is up for debate in my opinion: Software can be completed. You have a use case / problem, you solve that problem, done. Your software is completed now. There might still be bugs and they should be fixed ā but this doesnāt āaddā to the program. Donāt use āsoftware is never doneā as an excuse to keep adding and adding stuff to your code.
Okay, hereās a thing I like about Rust: Returning things as Option
and error handling. (Or the more complex Result
, but itās easier to explain with Option
.)
fn mydiv(num: f64, denom: f64) -> Option<f64> {
// (Letās ignore precision issues for a second.)
if denom == 0.0 {
return None;
} else {
return Some(num / denom);
}
}
fn main() {
// Explicit, verbose version:
let num: f64 = 123.0;
let denom: f64 = 456.0;
let wrapped_res = mydiv(num, denom);
if wrapped_res.is_some() {
println!("Unwrapped result: {}", wrapped_res.unwrap());
}
// Shorter version using "if let":
if let Some(res) = mydiv(123.0, 456.0) {
println!("Hereās a result: {}", res);
}
if let Some(res) = mydiv(123.0, 0.0) {
println!("Huh, we divided by zero? This never happens. {}", res);
}
}
You canāt divide by zero, so the function returns an āerrorā in that case. (Option
isnāt really used for errors, IIUC, but the basic idea is the same for Result
.)
Option
is an enum. It can have the value Some
or None
. In the case of Some
, you can attach additional data to the enum. In this case, we are attaching a floating point value.
The caller then has to decide: Is the value None
or Some
? Did the function succeed or not? If it is Some
, the caller can do .unwrap()
on this enum to get the inner value (the floating point value). If you do .unwrap()
on a None
value, the program will panic and die.
The if let
version using destructuring is much shorter and, once you got used to it, actually quite nice.
Now the trick is that you must somehow handle these two cases. You must either call something like .unwrap()
or do destructuring or something, otherwise you canāt access the attached value at all. As I understand it, it is impossible to just completely ignore error cases. And the compiler enforces it.
(In case of Result
, the compiler would warn you if you ignore the return value entirely. So something like doing write()
and then ignoring the return value would be caught as well.)
@movq@www.uninformativ.de Ewww š
We really are bouncing back and forth between flat UIs and beveled UIs. I mean, this is what old X11 programs looked like:
https://www.uninformativ.de/desktop/2025%2D06%2D21%2D%2Dkatriawm%2Dold%2Dxorg%2Dapps.png
Good luck figuring out which of these UI elements are click-able ā unless you examine every pixel on the screen.
@prologic@twtxt.net have fun!
@prologic@twtxt.net Enjoy your road trip! Have fun!! š¤
Gone on a road trip. Be back in a week š
Now I could. A few minutes ago I posted one, and it went to the void. I canāt delete, though. I get a lovely 403.
Can I create a post?
@bender@twtxt.net Ahh I see hmmm I donāt know this either š¤£
@kat@yarn.girlonthemoon.xyz I might give it a shot. š
Skimming through the manual: I had no idea that keeping the āupā cursor pressed actually slows you down at some point. š¤¦
@aelaraji@aelaraji.com I use Alt+.
all the time, itās great. š
FWIW, another thing I often use is !!
to recall the entire previous command line:
$ find -iname '*foo*'
./This is a foo file.txt
$ cat "$(!!)"
cat "$(find -iname '*foo*')"
This is just a test.
Yep!
Or:
$ ls -al subdir
ls: cannot open directory 'subdir': Permission denied
$ sudo !!
sudo ls -al subdir
total 0
drwx------ 2 root root 60 Jun 20 19:39 .
drwx------ 7 jess jess 360 Jun 20 19:39 ..
-rw-r--r-- 1 root root 0 Jun 20 19:39 nothing-to-see
@thecanine@twtxt.net With the teeth this looks like a vampire dog. :-D And I donāt get the reference either.
@aelaraji@aelaraji.com Oh, thatās great! I havenāt heard about any of them before either. Thereās also a caveat though, that I ran right into the very first time I tried this in zsh:
$ ls > /dev/null
$ echo $_
--color=tty
Yeah, exactly what you think:
$ which ls
ls: aliased to ls --color=tty
Alt+.
is going to be my favorite one! In the above, it would also give me /dev/null
, which might be probably more what I would expect.
@prologic@twtxt.net no, good man. Follow the link, follow eet! :-)
@movq@www.uninformativ.de omg yeah! this one looks cute too (iām weak to anything tux related!) but the commercial release has so much unpolished charm i love it! btw itās on [internet archive(https://archive.org/details/TuxRacerCD) if you wanna download & play it :]
@kat@yarn.girlonthemoon.xyz I like the animations in your version much better than the ones from ExtremeTuxRacer. š And thereās no little dance at the end of a race!
@aelaraji@aelaraji.com You mean Control R?
katseye does telenovela: the MV https://www.youtube.com/watch?v=CjnB56tSCQI
@bender@twtxt.net I SANG ALONG IN MY HEAD LMAOOO
I also just noticed that the performance issue doesnāt affect all games. š¤ Sigh, Iāll just downgrade for the time being. Not in the mood to fiddle with this.
@kat@yarn.girlonthemoon.xyz I guess that qualifies as an āArch momentā, albeit the first one I encountered. Iām running this since 2008 and itās usually very smooth sailing. š
@lyse@lyse.isobeef.org Yeah, YMMV. Some games work(ed) great in Wine, others not at all. I just use it because itās easier than firing up my WinXP box. (I donāt use Wine for regular applications, just games.)
@bender@twtxt.net Now I AM curious! What rabbit-hole? what am I missing here? š
Just discovered how easy it is to recall my last arg in shell and my brain went 𤯠How come Iāve never learned about this before!? I wonder how many other QOL shortcuts Iām missing on š„²
@kat@yarn.girlonthemoon.xyz šµ Grafana ana bo bana fifo bo bana gra fana!š¶ Donāt mind me, I am nuts.
@kat@yarn.girlonthemoon.xyz I recommend you to remain curious without crossing the threshold. Unless, of course, you truly want to follow a never-ending rabbit hole. š
GRAFANA IS DRIVING ME NUTSSSSSSS
@aelaraji@aelaraji.com iāve been curious about searxng!!!
@lyse@lyse.isobeef.org as long as i get to see silly little tux sliding around in a silly game older than me itās ok even if i committed windows/wine crimes to see it <33
I probably should implement some editing feature in tt
. Sure, I can easily edit my feed in vim to fix typos. But then I still have to manually remove the old message from the cache so that the new message is inserted on next reload and I donāt end up with āduplicatesā in the message tree.
@movq@www.uninformativ.de Must be a decode ago that I last used Wine. I wanted to play GTA2, but that didnāt go as planned.
@movq@www.uninformativ.de And there the air raid siren goes off.
@kat@yarn.girlonthemoon.xyz Oh no, how unpenguinly! But at least it runs, even races. :-)
pledge()
and unveil()
syscalls:
@movq@www.uninformativ.de That sounds great! (Well, they actually must have recorded the audio with a potato or so.) You talked about pledge(ā¦)
and unveil(ā¦)
before, right? I somewhere ran across them once before. Never tried them out, but these syscalls seem to be really useful. They also have the potential to make one really rethink about software architecture. I should probably give this a try and see how I can improve my own programs.
@movq@www.uninformativ.de arch moment
Wet t-shirt contest time! After our forest stroll I just wrung out the damn thing. Fuck me!
Speaking of Wine, Arch Linux completely fucked up Wine for me with the latest update.
Arch is shipping a WoW64 build now, which is not yet ready for prime time.
And then I realized that thereās actually only one stable Wine release per year but Arch has been shipping development releases all the time. Thatās quite unusual. Iām used to Arch only shipping stable packages ⦠huh.
Hopefully things will improve again. Iām not eager to build Wine from source. Iād rather ditch it and resort to my real Windows XP box for the little (retro)gaming that I do ⦠š«¤
@movq@www.uninformativ.de iām grateful that this works at least!
@kat@yarn.girlonthemoon.xyz lol, oof, well, better than nothing. š„“ It appears to run quite well. š¤
@kat@yarn.girlonthemoon.xyz UPDATE: getting it to run natively through a VM and other means all failed! so i did the cursed thing and tried the windows installer in wineā¦..
@thecanine@twtxt.net i do not get the reference but this is very cute!
Back to the future
from start to the end.
@aelaraji@aelaraji.com fuck yeah!
@movq@www.uninformativ.de missing libraries :( i expected it though
@movq@www.uninformativ.de Yup š Super interesting sruff š
@prologic@twtxt.net Ahhh, right, my bad, I could have easily found that. š¤¦
Thereās also a project page which lists some limitations of this study: https://www.media.mit.edu/projects/your-brain-on-chatgpt/overview/
It certainly sounds plausible. āUse it or lose it.ā
@movq@www.uninformativ.de I think itās here on MITās website: Your Brain on ChatGPT: Accumulation of Cognitive Debt when Using an AI Assistant for Essay Writing Task š¤
Felt the need to make this stupid reference - nobody will get, most likely. Feel free to guess (the file name and todays date, are both a hint), any other notes and opinions appreciated too, idk if I ever drew a standing one, from the front, before.
Achievement Unlocked: I have finally gotten to sit my ass down and watch Back to the future
from start to the end.
@prologic@twtxt.net But is there a source for it? Am I too stupid to use that site? š¤Ŗ
i.e: the ā~30-40% drop in cognitive capabilitiesā for chronic users of Chatp GPT š¤£
@movq@www.uninformativ.de I was more interested in the MIT research tbh š
@prologic@twtxt.net ⦠or just bullshit.
Iām Alex, COO at ColdIQ. Built a $4.5M ARR business in under 2 years.
Some āC-levelā guy telling people what to do, yeah, I have my doubts.
@prologic@twtxt.net This doesnāt cite any sources, might as well be satire. š¤
@kat@yarn.girlonthemoon.xyz Awww. :( Can you tell why? Missing libraries or does it just segfault?
update on tux racer: ofc it doesnāt run on modern linux LMFAOOOOOOO iām installing red hat in a VM right now
@doesnm.p.psf.lt@doesnm.p.psf.lt so sorry for your suffering, and loss. :-P
To really annoy my neighbors and everyone in a 5 mile radius, I might take my Model M and type a blogpost on the balcony. š
Ingredientes nas receitas americanas be like
3tbsp kosher salt
1oz unsalted butter
Quando alguƩm lhes explicar vai-se sentir as ondas de choque no planeta durante meses
@kat@yarn.girlonthemoon.xyz Cool, thatās a nice summary!
@kat@yarn.girlonthemoon.xyz uh, i use yandex mail which uses HTML by default
https://threadreaderapp.com/thread/1935344122103308748.html Interesting article on how ChatGPT is rotting your brain š¤£
This is so goodā¦
https://innig.net/teaching/liberal-arts-manifesto
by Paul Cantrell (@inthehands@inthehands)
@kat@yarn.girlonthemoon.xyz join the SearxNG cult! the grass is way greener over here š
@movq@www.uninformativ.de neither do I š and Iām going full Albert Camus mode. Embracing the Absurdism of life just to cope, itās the only choice I have left.
i ordered some fun colorful new minidiscs so i can finally get back to recording my mixes :D looking forward to it
@aelaraji@aelaraji.com iām so sick of AI summaries they piss me tf off
āThe only way to learn is to try. The best way to learn is to have fun.ā ā@ucodery@fosstodon.org
Unless your Terms of use update email looks and reads the same as the one I got yesterday from mastodon.social
, I donāt wanna know about it, nor do I agree to it.
@aelaraji@aelaraji.com Iād love to have a positive, optimistic reply to that, but ⦠uhm ⦠I donāt. š¤£
@kat@yarn.girlonthemoon.xyz Ooh, Iāve got to bookmark that page. š
@aelaraji@aelaraji.com I wish I had the luxury of not reading that junk. š But instead, I have a Mutt hotkey that pipes an HTML mail through elinks ⦠Bah.
FFS! Canāt I just get results, accurate no BS results? No erroneous/misleading AI-Slop of a summary Iāve never asked for ? I get it, there is plenty of people who LOooove (if not worship) that shit, Good for them! But at least make it opt-in or add in some kind of āDo Not Slopā browser option (as if the āDo Not Trackā one made a difference, but I digress). Shitās only going down-hill from here, I might as well as just spin up my own Searx instance and call it a day.
@prologic@twtxt.net Iām trying to call some libc functions (because the Rust stdlib does not have an equivalent for getpeername()
, for example, so I donāt have a choice), so I have to do some FFI stuff and deal with raw pointers and all that, which is very gnarly in Rust ā because youāre not supposed to do this. Things like that are trivial in C or even Assembler, but I have not yet understood what Rust does under the hood. How and when does it allocate or free memory ⦠is the pointer that I get even still valid by the time I do the libc call? Stuff like that.
I hope that I eventually learn this over time ⦠but I get slapped in the face at every step. Itās very frustrating and Iām always this š¤ close to giving up (only to try again a year later).
Oh, yeah, yeah, I guess I could ājustā use some 3rd party library for this. socket2 gets mentioned a lot in this context. But I donāt want to. I literally need one getpeername()
call during the lifetime of my program, I donāt even do the socket()
, bind()
, listen()
, accept()
dance, I already have a fully functional file descriptor. Using a library for that is total overkill and Iād rather do it myself. (And look at the version number: 0.5.10
. The library is 6 years old but theyāre still saying: āNah, weāre not 1.0 yet, we reserve the right to make breaking changes with every new release.ā So many Rust libs are still unstable ā¦)
⦠and I could go on and on and on ⦠š¤£
@movq@www.uninformativ.de > That guy over there in the cornerā¦
Iām literally sitting in a corner chuckles. I rarely get any emails nowadays. But if I do and it is not plain-text, then my Mutt gets to bark at it and I, just⦠wonāt read it. š¤·š½āāļø
š„ Brrrrrrrrr⦠Budāem⦠Tsssssā¦
@movq@www.uninformativ.de make that 4 people! i use plain text when i can because this page convinced me lmfao
Aha, afinal aquele episódio do ananÔs no carrinho do supermercado tem background histórico
@movq@www.uninformativ.de Hahaha š This is gold! Iāve been following along with our ramblings on Rust. Whatās it gone and done to you now? š¤ I donāt think I can ever be friends personally, I feel ātoo stupidā to learn Rust š¤£
@lyse@lyse.isobeef.org :ā-(
@kat@yarn.girlonthemoon.xyz Na, Iām too old for this shit.
#python AlguƩm tem o contato do Juan Lopes? @gwidion@gwidion ?
Acho que ele ia gostar de ver isso aqui:
@movq@www.uninformativ.de Yeah. :-( But hey, there are at least six of us using mail as it should beā¢. :-)
I sent the dealer an e-mail about that with all sorts of other issues as well. Letās see if they fix anything of that some day. Or yet just even read it.
@lyse@lyse.isobeef.org ⦠because you, me, and that guy over there in the corner are the only three people left using plain-text email. 𫤠(And probably Stallman.)
Fuck me sideways, Rust is so hard. Will we ever be friends?
It all started in New York in the early 1980s. Click, now 85, and his friends were sitting at the long bar of the New York Athletic club reading magazine articles about boxing, fencing, judo and wrestling. āOne of my mates said, āDude, we donāt do any of those things.āā They had to face it. They were dull. They decided to embrace their dullness.
As a joke, they started The Dull Menās Club, which involved some very silly, dull activities. They chartered a tour bus but didnāt go anywhere. āWe toured the bus. We walked around the outside of the bus a few times. And the driver explained the tyre pressures and turned on the windscreen wipers.ā
pledge()
and unveil()
syscalls:
@movq@www.uninformativ.de I like this idea š Very neat!
@bmallred@staystrong.run Oh sorry I should have explained those terms š¤¦āāļø
Come on, why is the bloody IBAN only in the damn HTML part of your e-mail but not in the plain text!? Grrr! Donāt you wanna get paid, dealer!? Your new web shop system sucks so bad, I want the old version back.
Me: I had a 7-day working sprint I should relax today before I teach a class in the eveningā¦
My brain: Good, as you donāt feel any obligation to work on your PhD today, you should just open the PhD working file and start working on it, no pressure. it will feel nice, I promise!
OpenBSD has the wonderful pledge()
and unveil()
syscalls:
https://www.youtube.com/watch?v=bXO6nelFt-E
Not only are they super useful (the program itself can drop privileges ā like, it can initialize itself, read some files, whatever, and then tell the kernel that it will never do anything like that again; if it does, e.g. by being exploited through a bug, it gets killed by the kernel), but they are also extremely easy to use.
Imagine a server program with a connected socket in file descriptor 0. Before reading any data from the client, the program can do this:
unveil("/var/www/whatever", "r");
unveil(NULL, NULL);
pledge("stdio rpath", NULL);
Done. Itās now limited to reading files from that directory, communicating with the existing socket, stuff like that. But it cannot ever read any other files or exec()
into something else.
I canāt wait for the day when we have something like this on Linux. There have been some attempts, but itās not that easy. And itās certainly not mainstream, yet.
I need to have a closer look at Linuxās Landlock soon (āsoonā), but this is considerably more complicated than pledge()
/unveil()
:
VocĆŖs traduzem āNew Yorkā para āNova Iorqueā nas citaƧƵes bibliogrĆ”ficas (local de publicação)?
āLearn Something Old Every Day, Part XV: KEYB Is Half of Keyboard BIOSā
https://www.os2museum.com/wp/learn-something-old-every-day-part-xv-keyb-is-half-of-keyboard-bios/
I wish I had the time and energy to play with #pyodide more, I could try adding #shapely to #pyp5js ā¦
https://pyodide.org/en/stable/usage/packages-in-pyodide.html
@bmallred@staystrong.run Ahhh this is an agent Iām tryining to play the game of Connect3. It uses a library written in Go Iāve been working on that supports Neuroevolution using Genetic Algorithms. Some features include: Mutation, Speciation, Lamarckian Evolution/Inheritence.
A day when you tell someone about Ezequiel Sotoās āPeriodic #Tilings with #RegularPolygonsā is never wasted!
new icon! the girl is manon from KATSEYE because iām mega obsessed with them