• 1 Post
  • 42 Comments
Joined 5 months ago
cake
Cake day: September 26th, 2024

help-circle

  • ZykinotoTechnology@lemmy.worldRust is Eating JavaScript
    link
    fedilink
    English
    arrow-up
    1
    ·
    13 days ago

    They are OS threads (so yes heavy).

    But I think if you manage to use-after-free or other memory error in safe Rust it’s a compiler bug. Or you used unsafe and have a soundness issue in the code you did.

    Note : as I understand it, unsafe is a way to tell the compiler you can check its safety guarantees yourself. But you may fail and get back other languages inexistent guarantees.


  • ZykinotoTechnology@lemmy.worldRust is Eating JavaScript
    link
    fedilink
    English
    arrow-up
    1
    ·
    13 days ago
    1. Is a modern language with a good build system (It’s like night and day compared to CMake)

    Meson exists … as do others.

    But they are not the default option. And your new job may not use them.

    1. And I just like how the language works (errors as values etc.)

    Fair enough; though why? What’s wrong with exceptions?

    Exceptions is a non standard exit point. And by “non standard” I’m not talking about the language but about its surprise appearance not specified in the prototype. Calling double foo(); you don’t know if you should try/catch it, against which exceptions, is it an internal function that may throw 10 level deep ?

    By contrast fn foo() -> Result<f64, Error> in rRst tell you the function may fail. You can inspect the error type if you want to handle it. But the true power of Result in Rust (and Option) is that you have a lot of ergonomic ways to handle the bad case and you are forced to plan for it so you cannot use a bad value thinking it’s good:

    • foo().unwrap() panic in case of error (see also expect)
    • foo().unwrap_or_default() to ignore the error and continue the happy path with 0.0
    • foo().unwrap_or(13.37) to use your default
    • foo()? to return with the error and let the parent handle it, maybe









  • neither strictly nor strictly typed.

    I think one of them should be “strongly”, but I understood your point.

    Thinking back, I don’t have the doc easily accessible (on phone), but I think the C API state the type you want to read. Like get_int(smt, VALUE_INDEX, …), so at least in the C API, most of this should not be visible. Maybe only the SELECT 1 = '1' part (or others comparaison fully done in the SQL string)?





  • I only have to “quotes” strings that contains globs. The rest mostly work or use the newer/recommanded way to do things for posix shells.

    But I must admit, I only use it interactively. For scripts I #!/bin/{,ba}sh. I will use something else once it won some/most the distro preinstalls (either nu, elvish, fish, but for now it’s sadly python).





  • I don’t know elvish, but I can’t get into nu. It is too different than what I learned (bash). I’m not sure I understand what they want to accomplish… Maybe I’m not the target, I use the shell to start commands as a dev, not as a devops or data guy…

    I also had a hard time using fish the first time I tried it. But since the version on Debian 10 I re-tried and now the only thing to know is “put the arguments in quotes if you want the command to do globbing”. With that you can use 99% of the commands you find on internet as is.