Login
You're viewing the functional.cafe public feed.
  • Nov 16, 2026, 8:22 PM

    Atomics may be a very small part of low-level software, but they really do manage to crystallize a lesson about how little of a problem space a computer can "think about" at a time. Most video game glitches are just two parts of the data not being logically sensible in relation to each other, which is somehow the central infamous problem of software while also being nearly invisible to even most practitioners.

    Explicit loads and stores are, where appropriate, an antidote to this invisibility. Which is why - this is going to sound like a much higher-level unrelated technology catching strays, but if you stretch your brain you'll see what I mean - ORMs are the product of and enabler of a terrible kind of lax thinking about where state lives and what is canon.

    💬 1🔄 3⭐ 0

Replies

  • Nov 16, 2026, 8:26 PM

    And yes, this is why Prone has shared mutable state, but you can't use it without "loading" the state into local pure data (explicitly makes visible that the original might change after loading) and you can't change it without "storing" a new version (explicitly makes visible that other consumers might have changed the original in the meantime), and offers compare-and-swap at a level of gigantic/nested container types. It's not quite general-purpose Software Transactional Memory, but it's as close as it needs to be, while still being something that should be possible to implement in a fast way most of the time.

    (the not-fast use cases are possible but discouraged by the API)

    💬 1🔄 0⭐ 0
  • Nov 16, 2026, 8:35 PM

    To be fair, I'm kinda conflating the Box type with reference types more generally. It's possible to make other mutable data types with their own mutation vocabulary - for example, a large bloom filter that allows you to atomically store a hash value, or check if that value is set. You *could* use the Box type to wrap a buffer for this, but it would be non-ideal in a couple ways.

    1. You could cheaply read it (copy-on-write), sure, but that's overkill for checking a single bit.
    2. You can't cheaply write to it, because any edits require a copy (one copy is owned by the Box itself).

    So a custom interface makes sense! But Box is still a good tutorial of the flavor that all of these interfaces have - explicit loads and stores, just at a range of granularities we don't often get in a language.

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 16, 2026, 9:33 PM

    @LunaDragofelis yyyes, ma'am, that they rightly can! The model is really that these are handles, which are almost pure data (you could model them as int IDs that you get and set the underlying values with service functions), with the main exception being reference counting.

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 16, 2026, 9:41 PM

    @LunaDragofelis That's the neat part! You don't! Pure data is acyclic, so reference counting is formally correct. Reference types can introduce cycles because they behave like GC roots. But in a properly structured program, these are rare enough to think about manually. Think "unsafe" in Rust, but only in terms of stigma. Prone ref types are safe but culturally gross.

    💬 0🔄 0⭐ 0