Diary 2019-04-25

By Max Woerner Chase

Didn't really touch node-graph today, might mess with it a bit during this post.

So far as trying to keep myself from badly reinventing existing technology, I've managed to talk myself into not doing a high-level implementation of low-level data structures, and instead try to put stuff together using existing libraries that—and this is excellent—I'm not responsible for maintaining.

Looking at node-graph, the thing I want to express is a constraint for the "visitor" type. Probably I should just make a base class for all of the "visited" node types I made yesterday, and base it on that. However, I also want it to be variadic, and uuuuugh. Screw it. Single-dispatch function of one argument that returns the real function. Everything is curries. Or, since the arguments are to be passed through to everything, maybe the arguments could be passed first, and return a single-dispatch function. Or the arguments could be bundled up into an object that the single-dispatch function takes as another type parameter. I think I'm going to have to take the "figure out what interface I want, then implement it" route.

Or I could try the "get a single-dispatch function from somewhere" route, since that seems most flexible and doesn't need as much scaffolding as some of the other ideas.

Hm. I messed around some, and I've got something that seems promising, though there's probably something wrong with the variance. I'll come back to it tomorrow, since it's almost midnight and I've got to get ready for tomorrow. Good night.