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

help-circle
  • It’s more than 10 years old. It has stable syntax, big standard library, big library ecosystem, plenty of rust programs already in production.

    If by “evolving” you mean “changing”, I don’t think that is an issue at all. At most, they add features. They don’t change or remove. And with the editions system, it should be no issue.

    If by “evolving” you mean “improving”, then I don’t see how that could ever be an issue.



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



  • As an analogy, just like dragging a 1000kg at 1m/s is not the same experience as dragging a 10g sphere at 1m/s. The same thing happened “something moved at 1 m/s”, yet they were very distinct experiences.

    That being said, Occam’s razor applies here. If it’s the same brain activity, it probably results in the same experience.

    But there’s still room for doubt. Since brains don’t all have the exact same amount of neurons arranged in the exact same way. And their chemical composition might be slightly different. They also change with age.

    I don’t think science can prove definitely that a slightly different brain structure won’t result in a different perception of color. Just like it can’t prove/disprove the existence of god. Some questions are just unsolvable. But science can get far enough so we say “this is probably true/false”


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


  • I’m no biologist. It’s very possible it’s an incomplete definition, and I don’t claim it to be a perfect one.

    I guess if we apply my definition to mules, each mule would be a different species lol.

    The horses one is a non-issue though. It doesn’t matter that they can create offspring of different species. Since 2 horses can potentially create a horse, then the horses are of the same species.

    And yes, my definition works only for sexual reproduction, since as seen by this article, asexual reproduction can get very complicated.

    I wouldn’t say it’s outdated and mainly for children. Just like Newtonian physics are very useful if we use it correctly. Having simple models that work in the situations we encounter most is useful even for adults.




  • That sounds like such a stressful life. Having to constantly police not only your property but your neighbours property.

    And that just won’t work when the aggressor is mightier than your local community, which doesn’t sound hard at all. Or if your neighborhood is more friendly towards your aggressor than towards you. Which would also end up in constant drama.

    I don’t like your solution at all.









  • Rust doesn’t have “safe” and “unsafe” modes in the sense your comment alludes to.

    You can just do the little unsafe thing in a function that guarantees its safety, and then the rest of the code is safe.

    For example, using C functions from rust is unsafe, but most of the time a simple wrapper can be made safe.

    Example C function:

    int arraysum(const int *array, int length) {
        int sum = 0;
        while (length > 0) {
            sum += *array;
            array++;
            length--;
       }
    }
    

    In rust, you can call that function safely by just wrapping it with a function that makes sure that length is always the size of array. Such as:

    fn rust_arraysum(array: Vec<i32>) -> i32 {
        unsafe{ arraysum(array.as_ptr(), array.len() as i32)}
    }
    

    Even though unsafe is used, it is perfectly safe to do so. And now we can call rust_arraysum without entering “unsafe mode”

    You could do similar wrappers if you want to write your embedded code. Where only a fraction of the code is potentially unsafe.

    And even in unsafe blocks, you don’t disable all of the rust checks.