• 6 Posts
  • 278 Comments
Joined 2 年前
cake
Cake day: 2023年7月6日

help-circle

  • installed on a lot of Linux systems.

    Fake info. It would be fake too if you made the opposite claim. Because such info is simply not available.

    VLC being an MPlayer clone with better branding has been a running half-joke for decades.

    The latest released version of VLC is not compatible with ffmpeg versions > 4.4 🤗. Some distros have actually considered dropping the package for that reason. Maybe some did, I don’t know. But if the situation doesn’t change, some definitely will.

    And VLC 4, which those who still care for some reason have been waiting for it to be released for years, is centered around libplacebo, a library that was factored out of mpv 😎 .

    I’m not emotionally charged against VLC or anything. In fact, I occasionally use it on Android. But what’s stated above is just facts.




  • As someone who doesn’t know scripting languages well, what does make the snippet you posted particularly Ruby-ish?

    Reading the guide, it felt like a relatively small consistent scripting language, with some Rustic touches. But I probably missed the touches from other languages I don’t know.

    But then, Rust itself took inspiration from many other languages, including Ruby itself. So, maybe everyone is taking from (or mimicking if you will) everyone.

    BTW, that last part can be written as*:

    # from iterator import each, to_list
    » square -> each (2,4,6,8) -> to_list
    ➝ [4, 16, 36, 64]
    

    which maybe mimics some other functional or functional-influenced language(s).


    * may require 0.15.1






  • Such posts are more suitable as microblogs IMHO.

    Anyway, string lengths are byte lengths, and indexing strings is actually not panic-safe. This is why we have (still-nightly) char-boundary methods now.

    If you want to work on characters. use .chars().count() and .chars().nth().

    And character boundaries are themselves not always grapheme boundaries, which is also something that you might need to keep in mind when you start writing serious code.

    With all that in mind, you should realize, for example, that probably every string reversing beginner exercise answer in every language is actually wrong. And the wrongness may actually start at the underspecified requirements 😉



  • What serious Linux users buy GPUs based on raw gaming performance on release week?

    I personally buy based on open-source driver support. And this includes long-term active support, AND developer approachability.

    My current GPU is an AMD/Radeon one because of that. But I’m reconsidering my position when my next hardware upgrade comes.

    I reported an AMD GPU driver issue to mesa once. It was tested, confirmed, and patched by a competent AMD developer within a few days. Now you have easily reproducible issues like this not even going past the testing phase after many months. And there are similar issues across all model generations.

    If I were to upgrade my workstation next year, I would probably go with an AMD CPU and an Intel GPU, which is the exact opposite of my current setup 🙃. One should never rely on outdated perceptions.




  • ExitCode is a struct, therefore it behaves like a type with many fields which define the types contained in the struct.

    That’s a bit too off. structs in rust are product types. A struct may define zero or more fields. And fields can be named or not. if not, such structs are called tuple structs.

    In the doc page, if you clicked on source, it would have taken you to the definition.

    pub struct ExitCode(imp::ExitCode);
    

    That’s a public struct with one unnamed private field. The type of the private field also happens to be private/internal.

    As for why, usually the purpose is providing type safety, a unified interface,… etc. Notice how for example a windows-only extension trait is implemented that allows converting raw u32 exit codes into ExitCode.

    So now you have exit codes possibly sourced from u8 or u32 values depending on the platform. And you need a safe unified interface to represent them.

    I hope that’s an enough starting point.


  • I would move all struct members from Foo<false> into a “new” Foo<true> and return that?

    Yes… if you don’t define Drop for Foo.

    If you do, then you will have to either use mem::take()/mem::replace() with each field, or if you don’t mind unsafe {}, you can just do a trivial transmute. Justunsafe { transmute(self) } should work.


  • BB_CtoRust Programming@lemmy.mlRuntime Const Generics
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 个月前

    I’m stating the obvious here, but if you have ownership at the time of conversion, then you can just change the type, you don’t have to use dyn (a la impl Foo<false> { fn into_debug(self) -> Foo<true> {} }). That may require some code restructuring of course.




  • BB_CtoProgrammingOn "Safe" C++
    link
    fedilink
    arrow-up
    9
    ·
    2 个月前

    Later: short summary of the conclusion of what the committee didn’t do (read 307 minutes)

    Fixed that for you.

    If you read the post, you will see it explicitly stated and explained how the committee, or rather a few bureaucratic heads, are blocking any chance of delivering any workable addition that can provide “safety”.

    This was always clear for anyone who knows how these people operate. It was always clear to me, and I have zero care or interest in the subject matter (readers may find that comment more agreeable today 🙂 ).

    Now, from my point view, the stalling and fake promises is kind of a necessity, because “Safe C++” is an impossibility. It will have to be either safe, or C++, not both, and probably neither if one of the non-laughable solutions gets ever endorsed (so not Bjarne’s “profiles” 😁), as the serious proposals effectively add a non-C++ supposedly safe layer, but it would still be not safe enough.

    The author passionately thinks otherwise, and thinks that real progress could have been made if it wasn’t for the bureaucratic heads’ continuing blocking and stalling tactics towards any serious proposal.