This is valid rust. I don’t know if there are more languages with this feature
- 0 Posts
- 310 Comments
calcopiritus@lemmy.worldto No Stupid Questions@lemmy.world•What is with this new generation of shooters writing stuff on the bullets? Is this some new fad like if I go deer hunting or something I write FUCK BAMBI on the bulllet?19·2 days agoSwords had phrases written on them too. This has been happening since forever.
No.
A stack overflow is a symptom, not the illness. A fork bomb is an illness.
Software coming from the mathematical point of view, assummes it has infinite resources. However, a real computer has many resources that are finite.
CPU time is finite. Memory amount is finite. There is a finite number of network ports. And so on.
A stack overflow just means: “you have run out of this resource called ‘the stack’”. The stack is a region of the memory. Each thread of each process has 1 stack, and it is not infinite in size. This program will cause a stack overflow because it is infinitely recursive, and each function call will consume a bit of the stack.
A forkbomb is not the end of a finite resource. A fork bomb is a program that uses “forking” to rapidly consume system resources. A fork bomb might cause a stack overflow. Or an out of memory issue. Slow the computer a lot. Or if the OS has a hard limit for process amount, it might reach that limit.
calcopiritus@lemmy.worldto Technology@lemmy.world•Exactly Six Months Ago, the CEO of Anthropic Said That in Six Months AI Would Be Writing 90 Percent of CodeEnglish2·3 days ago“in 20 years” doesn’t get as much hype as “in 3 months”
Maybe if they said “in 3 months” instead we would’ve actually have had it in 20 years. Seeing how much ai attracts money with these obviously unbelievable promises.
calcopiritus@lemmy.worldto Technology@lemmy.world•Exactly Six Months Ago, the CEO of Anthropic Said That in Six Months AI Would Be Writing 90 Percent of CodeEnglish181·3 days agoFrom the makers of “fusion energy in 20 years”, “full self driving next year” and “AI will take your job in 3 months” cones “all code will be AI in 6 months”.
Trust me, it’s for real this time. The new healthcare system is 2 weeks away.
EDIT: how could I forget “graphene is going to come out of the lab soon and we’ll have transparent flexible screens that consume 0 electricity” and “researches find new battery technology that has twice the capacity as lithium”
calcopiritus@lemmy.worldto Programming@programming.dev•I'm getting started with functional programming, which language would you recommend?2·3 days agoIt was years ago. So I don’t remember what exactly the problem was.
I believe ocaml has a shell interpreter and a compiler right? I managed to get the shell interpreter to work, but I couldn’t get one of these to work:
- Compiler
- LSP
The reason I prefer windows is because things just work. But it was a frustration with ocaml. Meanwhile rust was a single command for the compiler, and a single extension install for the LSP.
calcopiritus@lemmy.worldto Programming@programming.dev•I'm getting started with functional programming, which language would you recommend?53·3 days agoRust is not fully functional. But I am legally obligated to recommend it any time I can.
Jokes aside, this doesn’t apply to you, since you seem to actively learn functional programming. But for people that are scared of it, rust looks like “normal” languages, but has tons of features that can be attributed to functional programming. Even more so if you avoid using references. You can easily “mutate” objects the functional way, by passing the object to the function, and the function creates a new object with just some value changed.
It has algebraic data types. Function pointers. Iterators. Pattern-based match statements. Don’t have class inheritance. Inmutable by default. Recursion. Monads. And probably other FP features that I’m missing.
It has basically every functional feature while having familiar syntax.
It’s also extremely easy to install. Which I didn’t use to appreciate, but then I tried to learn OCaml and had to give up because I couldn’t set up a proper dev environment on windows.
calcopiritus@lemmy.worldto Programming@programming.dev•Opening folder via SSH from VSCode Web1·3 days ago- Why vs code web and not desktop vscode?
- At least on the desktop version, there’s a “><” (with the “>” being higher) looking icon in the lower left corner. Click that to open remote sessions.
I don’t know if vs code web can do remote sessions. So the button might not be there
calcopiritus@lemmy.worldto World News@lemmy.world•Wife of Ex-Nepali PM Burned Alive, Gen Z Revolt Engulfs Country: Live UpdatesEnglish7·5 days agoHistorically speaking, that will just make the next leader give many powers to the military in order to “bring peace” so whatever happened to the last one doesn’t happen to him.
I do enjoy cleaning code a lot.
When I work on shitty code I’m always thinking about how shitty it is and thinking on how a different design would make it much easier.
When you clean the code, you’re implementing that perfect design you were thinking of all that time. And you know from that point on you’ll be thinking less about how shitty the code is.
If your only task is to clean code and you’re not gonna work on that codebase afterwards, it’s not as rewarding though.
calcopiritus@lemmy.worldto World News@lemmy.world•Nepal lifts social media ban after 19 killed in protests: ReportEnglish231·6 days agoIn these situations, governments treat things like “Whatsapp” or “telegram” as social media.
They don’t ban social media so tech corps don’t fuck their population. They ban social media so their population can’t organize against them.
When brown, they are inmigrantes anda those are ghettos. When white, they are expats in expat communities.
calcopiritus@lemmy.worldto You Should Know@lemmy.world•YSK that you can force Windows 10/11 to open your default browser instead of MS Edge with MSEdgeRedirect21·12 days agoOr you can just uninstall edge.
calcopiritus@lemmy.worldto World News@lemmy.world•Sixty-nine people drown as migrant boat capsizes off coast of MauritaniaEnglish2·16 days agoMigrant to me is the more accurate word.
Migration can be seen from 2 viewpoints, “emigration” and “immigration”. Depending if you are looking from the country of origin or the destination.
However, in this headline neither the origin nor the destination is mentioned, therefore it doesn’t make sense from either point of view. Therefore the viewpoint-agnostic “migrant” makes more sense to me.
calcopiritus@lemmy.worldto Technology@lemmy.world•Holding back China's chipmaking progress is a fool’s errand, says U.S. Commerce Secretary | Tom's HardwareEnglish31·9 months agoNotice how you didn’t even consider the possiblity of just china and Taiwan being separate countries. Which is how many civil wars end (the US civil war is not the only civil war). It is also the ending that causes less harm overall. The taiwanese don’t die, and the Chinese don’t “give in to separatists”, because they are not separatists. You can’t separate from a state you never belonged to. The taiwanese were never part of communist china.
calcopiritus@lemmy.worldto Technology@lemmy.world•Holding back China's chipmaking progress is a fool’s errand, says U.S. Commerce Secretary | Tom's HardwareEnglish16·9 months agoWhat the taiwanese want is sovereignty.
The threat of blowing up TSMC if invaded helps with their sovereignty because it both avoids the Chinese attacking them and helps the Americans defend them.
calcopiritus@lemmy.worldto Technology@lemmy.world•Youtube adds setting for uploaders to allow third party AI training on videosEnglish16·9 months agoDon’t worry. This is just third party AIs. Google’s AIs will still be trained on them without your permission.
calcopiritus@lemmy.worldto Technology@lemmy.world•OpenAI whistleblower Suchir Balaji found dead in San Francisco apartmentEnglish311·9 months agoWhen the working class kills a CEO, there’s a reward by the FBI and is found in a week. When a company does it, the world is silent.
calcopiritus@lemmy.worldto Ask Lemmy@lemmy.world•Whats the oldest human made item you can buy for around 100€?2·9 months agoYou would think that because of that, people would melt them down when they became no longer useful as currency.
Because it can be done for multiple lines too. And you can do else-if too. Also, “if” and “else” is more recognizable than “?” and “:”
x = if y > 5 { println!("Y was over 5"); z + 5 } else if y < 0 { handle_negative_y(y); z - y } else { println!("<WARN> unexpected value for y"} 0 }