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

help-circle
  • I always like "by example"s for learning languages - here’s Rust’s.

    I’d probably make a project with it. Maybe a CLI tool using clap_derive and some crate that does something neat that you want to do. Depends what you’re interested in I guess.

    I wouldn’t recommend trying to do leetcode problems with Rust because they are obsessed with linked lists and linked lists are awkward in Rust.

    Also I wouldn’t recommend making a game or GUI app with Rust yet since the ecosystems there are immature.

    A microcontroller project using Embassy is probably a fun way to learn too but I haven’t actually tried it yet.






  • He also thought that Rust integrates poorly into project with a deep C++ OOP hierarchy. That is probably still true as well.

    Is there any language that can do that? As far as I know there isn’t. You can use SWIG or whatever but it’s just as awful as any Rust/C++ interop. There’s Carbon, but that’s a work in progress.

    IMO if you need integration with a deep C++ OOP hierarchy your options are a) give up and just use C++, or b) pain, no matter what language you target.







  • Using a function is strictly worse than figuring out the formatting at compile time (something Zig also does).

    The derives are just shortcuts. You can write everything out long-hand like you would in C++ or Python too if you really want.

    Honestly both of these complaints are essentially “why does Rust use macros to make writing code better/easier?”.






  • I mean, it would be great if this succeeded… ffmpeg is nice and all but its interface is clearly terrible and there’s absolutely no way it is remotely secure. Anyone that uses it on a server basically has to run it in its own VM, or a severely locked down sandbox.

    But good luck supporting all the codecs people expect. I’m not even talking the obscure ones ffmpeg supports; just the ones “normal” people use will be a life’s work.

    Also you have to change the name!


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