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

help-circle

  • The edge of the observable universe is not because of that.

    It is because space expands. Therefore everything goes away from everything else. Therefore, everything goes away from us. And the more space there is between us and that other thing, the more space expands, since there is more space. Therefore, things that are farther away from us, get away from us faster than everything else. Only if it is close enough to us that gravity is strong enough would that something not move away from us.

    This creates a peculiar situation. Things that are far enough away from us, actually move away from us faster than the speed of light. This means that no photon ever emitted from this far away will ever reach us.

    That is the edge of the observable universe. The distance at which a photon emitted in our direction will never reach us, since for every meter the photon travels, there is at least a meter of space “created” between us. Therefore it never progresses in moving towards us, in fact, it moves away from us even though it is traveling in our direction.


  • This is not a list of all the things they are banning AI from.

    This is a list of every reasonable use of LLMs they can think of in their environment.

    So if anyone thinks “hmm, I know they don’t like LLM contributions but I’m just going to use it once for X”. The immediate next thought should be “They don’t even allow LLMs to spell check, therefore my single use of LLM for X will not be welcome, I will not do it”.

    Basically none of this is enforceable. The rules are there so if someone is caught doing something, it can be pointed out that that something is written in the rules. And also to give a general sense of what is tolerated or not in a community.

    This reminds me of a traffic law in my country:

    It is illegal to go all the way around a roundabout 3 times in a row. There is not a police officer ok every roundabout, or a camera counting how many times you go around it. But if a kid goes off and do stupid shit at 2AM with a loud AF car, one of the things one might do is do many loops on a roundabout. Therefore they can’t just say “I’m not doing anything illegal, I’m just using the public roads with my car and a valid driver’s license”. Since one of the things they did was doing more than 3 rounds in a roundabout.


  • If you come with reddit mentality, you’re gonna see reddit eveywhere. In Lemmy, upvotes are not a popularity contest. There is no karma. Votes have no use other than sorting.

    One of the reasons my comment may have more upvotes might be because it directly answers the question of the commenter above.

    OP didn’t ask what the borrow checker was, OP asked if it was an integral part of rust, and I answered it. Just like another commenter asked more specific questions about rusts’ borrow checker and I answered them.

    Another reason might just be that my comment has more entertainment value, while the other one is purely educational.

    Another reason might be that Lemmy is already full of rust explanations, therefore there are probably not a lot of people left to learn how it works.


  • You can reference count, but you must do so explicitly, just like in C++ you have to explicitly use std::shared_ptr, in rust you must explicitly use std::rc::Rc.

    Rusts’ memory safety is managed at compile time, that’s what the borrow checker does. It enforces a strict set of simple rules that guarantee at compile time that all the references are valid when they are used. This means that there is no runtime cost.

    Q: “Why would you use Rc then? It would only introduce runtime overhead that is not needed because rust already checked that the program is correct”

    A: the borrow checker ensures that your program is valid. However, not all valid programs are allowed by the borrow checker. That is what unsafe is for. unsafe allows you to skip some rust safety features if you want to make a program that is valid but rejected by the “safe” rust compiler. Rc uses unsafe internally to expose an API that is safe, but allows you to do things that would normally be rejected by rust.

    Of course, the borrow checker is not all the safety features of rust. There are some safety features that actually do have runtime checks.

    For example, you can try to access invalid memory by reading out of the bounds of a buffer/array. Most of the time, it is impossible/impractical to solve for this at compile time. Therefore, a bounds check is done on every array access, if the check fails, the program crashes. That check is done at run time. Many times the compiler will optimize those checks, but sometimes they just cannot be optimized out.


  • Low level goes way beyond raw pointers. But yes, rust does have raw pointers.

    Java does have raw pointers too I believe though. I wouldn’t call it low level.

    But low level is not well defined. At some point, the difference between low level and high level used to be whether you had to write a different program for each computer architecture. Under that definition, C is a high level language. Assembly (and very old languages) would be low level.

    My own definition of low level is: if you have to care at all about memory management, it’s low level.

    Basically, if the language has a garbage collector or if it automatically counts references without you explicitly telling it so, it’s a high level language for me.



  • Yes, the end goal is very similar to a garbage collector. Both are advanced systems of memory management.

    The most important difference being that a garbage collector runs at runtime, while the borrow checker at compile time. Which means that the borrow checker has 0 impact on the program’s performance. It just takes longer to compile the program.

    Which also means that, while the garbage collector says “you can do whatever you want with memory, don’t worry about it, I’ll handle it for you”. The borrow checker says “you fucking donkey. Why did you do that? I won’t compile this if you don’t fix it”.

    So you trade programmer comfort for performance (end user comfort).


  • Lemmy is social media, not school. Nobody owes an explanation. Mostly because the poster cannot know the knowledge level of whoever is gonna read the post. If every post has to be explained for every potential person that could read it, every post would be followed by a wall of text. Of all social media, the only time I’ve seen it happen is pugjesus’ history posts. Which makes sense since he often references some niche history knowledge that very few people would know about.

    Just googling “borrow checker” would’ve shown you it’s something rust-related.


  • Yes. Someone that knows just a little more of rust than you do would know what the borrow checker is.

    It’s the core feature of rust.

    Like talking about java and not knowing what “inheritance” is.

    EDIT: just so you understand how vibecoded that project is.

    The dude says he vibecoded “some of it” because some rust features make it a hard language for him. The one feature he’s talking about is the borrow checker.

    It’s like saying “man, sure is hot today”. Someone says “yeah, this summer sure is hot” and the dude replied “yeah, summerians lived in a hot place too”.











  • If it’s not open source or you are not compiling it:

    Why so much fear about the shell script but no fear from the executable?

    If it’s open source and you are compiling it:

    If you don’t fear the project because you (presumably) have read the source code and determined that it’s fine, why fear a shell script that is most certainly simpler, and you can read it like the rest of the code?