• 2 Posts
  • 712 Comments
Joined 2 years ago
cake
Cake day: September 24th, 2023

help-circle






  • That is not actually a “data race”. It is a race condition for sure, but a data race is a very specific thing - where two threads access the same location at the same time and at least one is a write.

    That could be unsafe in Rust because it might lead to reading “impossible values” like an enum that isn’t equal to any of its variants. Therefore safe Rust must prevent it or there’s a soundness hole.








  • it has modules for everything

    Not everything. PyYAML, Pydantic and Typer are things I commonly want in scripts that aren’t in the standard library.

    Simply do pip install anything. But best practice is to use a python virtual environment and install packages into that one.

    It’s more than “best practice”. It’s mandatory on many recent Linux distros. And yeah setting up a venv and installing dependencies is not something you want to have to do for each script you run.

    Its one of the slowest to write code in.

    It depends what your goal is. If you want robust code that works reliably then I would say Rust has the edge still. Yes it will take longer to write but you’ll spend way less time debugging it and writing tests.


  • That’s kind of the point. You can do it in most languages, so why use a shitty one like Bash? Use a good language like Rust!

    Also there are aspects of languages that make many languages less suitable for this application though. For example Python, because you can’t use third party dependencies (or at least you couldn’t; I think uv has an equivalent of cargo script now). Java would be a pretty awful choice for example.



  • Right, I’m not saying it isn’t simpler in terms of syntax. The point I was making is that the syntax is simpler but in a way that makes it worse because while it’s easier for computers to read, it’s harder for humans.

    it was only later discovered that they can be compiled down to native code.

    That sounds extremely unlikely. I think you’re misinterpreting this quote (which is fair enough; it’s not very clear):

    Steve Russell said, look, why don’t I program this eval … and I said to him, ho, ho, you’re confusing theory with practice, this eval is intended for reading, not for computing. But he went ahead and did it. That is, he compiled the eval in my paper into IBM 704 machine code, fixing bugs, and then advertised this as a Lisp interpreter, which it certainly was. So at that point Lisp had essentially the form that it has today …

    As far as I can tell Lisp was always intended to be compiled and executed. That quote is about compiling the eval() function (which was just meant to explain how Lisp is executed) into a binary and using that as an interpreter.

    Also I skimmed the paper that is from, and in fact Lisp was intended to be targeted by AI (in the same way that we get AI to write and execute Python to solve problems), which explains a lot. It wasn’t designed for humans to write, so why bother with nice syntax; just have the machine write the AST directly!

    (I expect that was only part of the motivation tbf, but still!)


  • This comment perfect captures why I don’t like Lisp. Essentially “it’s simple, this easy to read code transforms to this AST”. Lisp basically says “we can make parsing way easier if we force programmers to write the AST directly!” which is really stupid because computers can perfectly well parse syntax that is easy for humans to read and turn it into ASTs automatically.

    It makes it easier to parse for computers at the cost of being much harder to parse for humans, which is really the wrong choice in most cases. (The exception is if you’re DIYing your compiler, e.g. if you’re teaching how to write a compiler then Lisp is a good target.)



  • Yeah it’s great for little scripts. There’s even a cargo script feature that’s being worked on so you can compile & run them using a shebang.

    I’d use a shell script if it is literally just a list of commands with no control logic or piping. Anything more than that and you’re pointing a loaded gun at your face, and should switch to a proper language, of which Rust is a great choice.