1. 3

    I like this technique, I just find it hard to apply to the kind of code I work on, which heavily uses variable-size objects like strings/vectors/maps.

    One way to adapt it is to drop down to byte granularity, so the handles are byte (or word) offsets, not array-of-struct indexes. But obviously you lose a lot of the benefits, especially the easy reuse of array elements — you either end up with a write-once arena, or have to reimplement malloc inside your mini-heap. The biggest remaining benefits are locality of reference and small handles. (I just used this technique last week to implement a string table I know is limited to < 64kb.)

    The article also set off some alarm bells related to concurrency — that “pointers are only valid for a brief period” stuff is a bit hand-wavey and falls apart completely with multi-threading. It actually reminds me of Handles in the old Mac OS (1–9), which were pointers-to-pointers. A derefed Handle would only remain valid until the next call that allocated memory, since the allocator sometimes had to relocate blocks. This was the source of many, many, many troublesome bugs, even in a single-threaded OS.

    1. 2

      One way to adapt it is to drop down to byte granularity, so the handles are byte (or word) offsets, not array-of-struct indexes.

      I think one of the examples (https://github.com/floooh/sokol#sokol_gfxh) does something like this.

    1. 6

      On the job front - not so well. I was laid off in April with just a year of professional experience. I’m sure it’s mostly due to covid, but I rarely hear anything back after applying. I’ve been trying to stay sharp with personal project and leetcode (although procrastination has been a consistent problem lately), so I’m really just hoping I’m prepared enough if an opportunity were to come through.

      Otherwise - I’ve had a lot of time to practice music, read, and hang out. So no complaints there.

      1. 1

        Wow, super cool. I’ve been writing a little bit of chicken scheme lately so I cant wait to play around with this later

        1. 2

          Continuing the job search and trying to convince myself that it’s worthwhile to follow through and finish small personal projects.

          1. 3

            I’m in that boat as well. One of my secrets is to have my personal projects in widely-varying fields so that I don’t have to force myself if I’m not feeling it at the time.

          1. 3

            Playing around with my new void linux install.

            Hopefully writing some Haskell (have to figure out what I want to build).

            Hopefully building a desk (have to buy wood).

            1. 5

              There was a thread a couple days ago on socket programming and networking in general with some pretty good recommendations

              1. 1

                I use Hakyll with some minor adjustments to the default theme which is fairly minimal to begin with. The generator uses pandoc for file conversion, and if you’re familiar with Haskell it’s very configurable.

                1. 1

                  nice write up. i’m always on the lookout for some way to bridge the gap between beginner/intermediate Haskell (things in Haskell that I understand) and advanced Haskell (things in Haskell that I don’t understand). I’ve been on the fence with this book for a while, but it seems like it might be a worthwhile purchase

                  1. 2

                    Thanks. The book is definitely useful to understand more sophisticated type-level stuff in Haskell but IMO that’s just one of many things about advanced Haskell.