• 0 Posts
  • 310 Comments
Joined 2 years ago
cake
Cake day: September 2nd, 2023

help-circle



  • 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.





  • Rust 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.




  • 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.