Coding 2020-04-04

By Max Woerner Chase

I got a little bit more done on the port earlier today, but I also looked over the code, and realized that I'd already gone over all of the code that would have to be changed for a particular behavior change I wanted, and I hadn't changed it, which means it must be possible to write a failing test case for that behavior. And it is. Given the following Ink file:

* Text: {a|b}
-

The choice displays initially as "Text: a", and, after it is taken, as "Text: b". (Followed by a newline.) I spent a bit of time trying to figure out how to change this behavior, and, once again contrary to my initial expectations, it's not obvious to me right now. The problem is that, at least according to my ad-hoc prints, it's hard to get a sense of "context" within the VM's stack-based execution.

I've got an idea, which I'm just going to write up, and not attempt yet, that the following might be a workable starting point:

When the parent of the "previous path" is not an ancestor of the "current path", stop visiting containers "at the start", until the "current path" is not a descendant of the first "current path", modulo sticking a tunnel in the middle, so I guess this would have to be tracked on the stack. Or maybe following a choice needs to put some new data on the stack to determine when to start tracking data again.

I'm pretty sure that first idea would break most things catastrophically, so I'm not going to try it right now.

One thing that all this messing around has made me realize is that I've got a bunch of not-all-compatible things I want out of this port.

One is to basically audit the codebase, and submit the Python version to automatic analysis that can hopefully shed light on the C# version. This requires relative fidelity to the original codebase.

Another is to have a version of Ink that I can easily use in my Python projects. The big priority here is optimization, followed by adding features that I want.

I'm going to take a stab at explaining what happens with the Ink code I posted above, so I can get my thoughts in order:

Perhaps if following a choice made it so that:

That might work. Maybe. And it still might break things. I'll have to try this out later. For now, it's late and I'm tired.

Good night.