Spyke

Replies

Comment on

borrow checker?

Reply in thread

Very integral. When someone says they're "struggling with Rust", it's thanks to the borrow checker.

Rust's whole shtick is the way it manages memory, which is the rules enforced by the borrow checker.

Basically:

When you want to store values in variables in any programming language, the memory should be allocated when you need it and freed as soon as you don't anymore.

Traditionally there are two ways this is done:

  1. You manage it completely yourself, which is "unsafe" as you can forget to free memory you no longer need. This is called leaking memory. Or "reference" the location of something you freed previously, thereby attempting to read data you may not have permission to read (the OS will usually prevent that and kill the program), or reading and using a value you didn't expect, causing undefined behavior and fun to deal with bugs.

  2. The language, sometimes using a process which runs alongside your main program, manages memory. Which adds lots of overhead.

Rust has it's own way of doing this: It adds some rules on how you can pass around references and ownership and these rules are affected by whether you can or can't edit the referenced data. All just so the compiler knows the lifetime of the vars that hold that data and when it can free it (before the program is even compiled, so no overhead when the program is running). Not following the strict rules prevents your program from being compiled into an executable.

The compiler gives very helpful info, tips, and pointers™ though, Rust is also know for this.

Comment on

Self-immolation of Aaron Bushnell

Reply in thread

My old profile on kbin.social was created 2 years ago, after kbin.social went offline I made a lemmy.world account then made one on this MBin instance.

It's very difficult to not post anti Israeli stuff if your posts are related to the middle east, or if you have a shred of empathy.

Comment on

FBI Uncovers Al-Qaeda Plot To Just Sit Back And Enjoy Collapse Of United States

Reply in thread

It's not connected and going LTR instead of RTL, but it seems to say: "We are waiting now to allow the west to destroy itself under the burden of it's extreme special gluttony (greed)"

Original, but connected & RTL: "ننتظر الآن والسماح الغرب بتدمير نفسها تحت وطأة الشراهة الخاصة" Better phrasing & grammar: "**ننتظر الآن للسماح للغرب بتدمير نفسه تحت وطأة الشراهة المفرطة"

Comment on

It's A BIG Club & You Ain't In It! - George Carlin

Reply in thread

There's a popular frontend for Lemmy called "Tesseract". About a week ago the dev pushed an apparently malicious update with a block list which contains lots of leftist (as in even slightly left leaning) communities and users.

OP searched for and found his username in that block list.

The file OP searched in is "policy.json", which doesn't exist in the source code. The command pulls the content of the url decodes it from base64, unzips it and puts the content in policy.json. Which means the source code obfuscates the file by default.

(the only file called "policy" I could find in the source code is a .dat file which has the encoded data).

world

Comment on

Hundreds of Gazans march in rare anti-Hamas protest

Reply in thread

It seems the majority of people here actually believe that without Hamas Israel would just stop invading and pull out. This might have been wishful thinking a while ago, but right now this is called delusion, as we've seen what happens when you tell Israel you won't attack and are willing to cooperate for the benefit of both sides (Syria and Lebanon).

Comment on

*Permanently Deleted*

I honestly wouldn't care if it stayed at one or two of them, but I know if I leave these things and treat them as pets I will get an infestation in no time.

And with each new one the chances of me feeling one of them walk on my arm increases, and I am not letting that happen.

fuck_ai

Comment on

After using ChatGPT, man swaps his salt for sodium bromide—and suffers psychosis

After seeking advice on health topics from ChatGPT, a 60-year-old man who had a "history of studying nutrition in college"

His ChatGPT conversations led him to believe that he could replace his sodium chloride with sodium bromide, which he obtained over the Internet.

Three months later, the man showed up at his local emergency room. His neighbor, he said, was trying to poison him.

He did not mention the sodium bromide or the ChatGPT discussions.


When the doctors tried their own searches in ChatGPT 3.5, they found that the AI did include bromide in its response, but it also indicated that context mattered and that bromide was not suitable for all uses. But the AI "did not provide a specific health warning, nor did it inquire about why we wanted to know, as we presume a medical professional would do," wrote the doctors.

You know what's the first thing I would do when anyone (or anything) tells me to start substituting something everyone consumes for a chemical compound I've never heard of? I would at the very least ask a doctor or search it up.

Summary: Natural selection

memes

Comment on

a slightly rusty meme, but it's still funny

Just yesterday I had the "Memory shortage avoided" message after opening the gazillionth Firefox tab. The wording with the bomb icon is very funny. It really makes you imagine the kernel murdering the unsuspecting process in cold blood and then reporting to you what was done and what actions are expected of you calmly.

Comment on

What's stopping you from writing your Rust like this?

Reply in thread

In Rust and lots of other languages you have to end each statement with a semicolon. The semi colon is usually placed right after the statement, but in this example there's indentation after each statement before the semicolon so they're all aligned.

There's also the curly brackets, they're padded in the same way, but those usually define where a scope (block) starts and ends making it even worse.