tef
@tef

it's harder than you might think.

good news though, it's someone's special interest topic and she's spent the better part of a year making a video.

freya's animations have been a blessing on the timeline, and this video has really high production values and polish. down to the bit where you're going "but wait... what about this?!" and the video goes "so you might be asking..."

or if you will, there's smooth narrative flow in video about curves (heh)

anyway: stuff like this is what math education should be like, and i don't just mean the animations (which rule). what i mean is that the video opens with "here is a problem we're trying to solve" and introducing concepts like differentiation, continuity, and curvature as we get closer to solving it

it isn't about the concepts or tools, it's about why we need them, how they're useful, and a bunch of fucking around and finding out to solve the problem at hand. it's great.



eniko
@eniko

I know I was supposed to talk about memory allocators but I'm feeling self indulgent so instead I'm going to talk about the C strings API that I created for my fantasy console that runs on a Motorola 68000 CPU with Mega68k as a working title.

Because, you see, C strings suck. In fact C strings don't even exist. They're just like, a gentleman's agreement to think of things which aren't strings as strings. And that sucks. They're also unsafe af (any time you hear about a buffer over or underrun security issue it's basically always C strings that are the culprit) but that's not even my concern. They just feel bad to work with. C strings have bad vibes.

Part of that is that C has no automatic memory management. Strings can't refer to anything else so they're actually perfect candidates for reference counting, but C doesn't have anything like C++'s shared_ptr<T>... or does it? GCC and Clang actually have the cleanup attribute. Used like so:

void destroy_int(int* value) {
    printf("destroying int %d\n", *value);
}

void foo(void) {
    printf("before scope\n");
    {
        int __attribute__ ((cleanup(destroy_int))) i = 12;
        printf("i = %d\n", i);
    }
    printf("after scope\n");
}

// output:
// before scope
// i = 12
// destroying int 12
// after scope

This means we can "clean up" a named variable once it goes out of scope, which brings us 80% of the way to automatic memory management. And that, my good reader, is where the fuckery starts in earnest.