Coding 2022-10-13

Tags:
By Max Woerner Chase

After writing some more jank Koka, I believe that the state of local variables is the same after each call to resume() in Koka. Maybe there's an obvious reason that it has to be that way, but I was frankly pulling my mind in too many directions at once to be able to tell.

So, let's think some more about how variables should act. The big hurdle if I do go with "all stack variables are predictably-sized fat pointers to arbitrarily shaped objects on the heap, and there's a reference count somewhere", is that it gets kind of hard to to write a pure function, at least I think so.

Supposing we have a list/vector type that works kind of like in Python, because I think I want that. It's possible to express read-only semantics for the fat pointers here, but it doesn't actually help, because something else can take a reference to the object and mutate it. This is what has me thinking "hm, maybe capabilities would be useful somehow". Like, if a function relies on val, box, and tag type references to external data, then it shouldn't be possible to break purity by changing the objects behind those references, because they can't change from the perspective of the function.

This is complicated, so I'm going to try to break it down into reasonable steps.

So, if I want things to work the way I think I want them to, then I need to be able to implement the following setup:

I won't say that's a lot of the work, but if I can't do that much, then I need to reconsider the entire big picture of the design.

The near-term stuff to do goes as follows, but not in any particular order:

It's good that I have goals, but next up, I need a plan to make sure I actually work on them. I'll see how that goes. Anyway, no more to do for today.

Good night.