… the story of how I identified the bug …

  • TehPers@beehaw.org
    link
    fedilink
    English
    arrow-up
    4
    ·
    8 months ago

    For shared, immutable lists, you can also use Arc/Rc in place of Box! I guess what’s surprising is that [T] (and str/Path/OsStr/etc) are traditionally associated with shared borrows (like &[T]), but they’re really just unsized types that can be used anywhere there’s a ?Sized bound.

    Also, overuse of lists (as opposed to other data structures) seems to be a common problem in all programming languages among less experienced devs since they’re simple enough to use in most places. Not saying that’s what happened to the author though - these types are way less obvious than something like a hash set or queue.