• 1 post
  • 110 comments
Joined 3 years ago
Cake day: June 12th, 2023
  • There’s a lot here that I could comment on, but I’m particularly fascinated that you make a big deal about const by default.

    First of all, it’s not particularly good evidence that rust is functional, you could just as easily have a const-by-default java or c. Rust still has mutable data structures which is decidedly non-functional. I do actually think that rust is more inspired by fp than a lot of other languages so it’s not even that you’re completely wrong here, it’s just an odd example.

    Secondly, do you actually think that const variables is a bad default? Personally I find that it makes it code easier to read when the author is explicit that a variable is going to be mutated down the line because it makes the intention clearer. It also makes it easier for the compiler to make certain optimizations which is significant in a low-level language.

  • You can tailor the rust standard library to be more embedded friendly in several way, like if you don’t have dynamic memory allocation or a filesystem, you can get the standard library sans those features.

    Rust also gives you a very fine grained level of control of memory, I think equivalent to C (maybe there’s some gotcha that I’m not aware of but if not equivalent very close).

    It really doesn’t sound like you know that much about Rust here and are just making things up, you certainly don’t need “gigabytes of storage and memory”

  • One thought I’ve had about AI and programing is that you’ll run in to a similar problem. Code is a bit special because it’s a language that’s understandable by both humans and computers, and when you’re programing you’re essentially writing for both audiences at once.

    Voice is maybe not as important when writing code (although you still want to keep the coding style consistent) but even so I think that writing code by hand has the advantage of you being able to express your thoughts in a more coherent way than the output of a handful prompts will. The problem isn’t just with however powerful the AI model is, but that prompting is a kind of vague and indirect way of interacting with the system and it necessarily introduces another layer between the author and whoever ends up reading it.

  • I try to write comments whenever what the code isn’t obvious on its own. A “never write comments” proponent might argue that you should never write code that isn’t obvious on its own, but that doesn’t always work in practice

    • Sometimes you have to write cryptic code for performance reasons
    • Sometimes you have to deal with unintuitive edge cases
    • Sometimes you have to work around bugs in 3rd party code
    • Sometimes you are dealing with a problem that is inherently complex or unintuitive, no matter how you put it in to code