Ink-Py 2019-11-25

By Max Woerner Chase

Things are a little out-of-control right now, but I'm trying to stop it from getting to me.

I'm starting a new category today because I seem to be going in on this whole "Hey, let's try porting Ink to Python again" idea, and that's fine with me.

I've tried a few times in the past, and my efforts have mostly just led to bug reports and PRs against the C# version. (I actually forgot about the PRs, and was really confused for a little bit, seeing the "Contributor" badge on GitHub.)

What tripped me up in previous attempts was not, as other people's attempts might have it, that Python just isn't practical for implementing a VM like Ink. I would argue that PyPy stands as a counter-example to that sentiment.

My big issues adapting the C# codebase centered around non-local reasoning, circular references, dead code, and a lack of familiarity/ease on my part with some C# features.

For the last point, I just want to understand things well enough to come up with an equivalent in Python.

The other points can be summarized as: I don't know whether a given section of code is actually used, I don't know how many times a given field is set and with what range of values, and some pairs of objects are so tightly coupled that it's not clear to me which one of them "should" have a given bit of functionality.

That probably seemed mean, but it's the truth. I really was looking at some functions thinking "Okay, what on earth is the equivalent of this in Python? Like, I can't translate this directly for all possible ways this function could be called, so I'll have to specialize it for potentially each of the call sites, of which there are... none. Well, that was a waste of time."

So, the fundamental thing I was doing wrong in my previous attempts was, I was trying to directly translate an internal bit of code before I had the context on how it was used.

Now, some people advocating for particular practices to improve software quality really like tests. "Write your tests first!" they say. "Tests are the most important code, because you can use them to recreate correct product code, but you can't derive correct tests from your product code!" I haven't had the guts to take them up on the second assertion, but it looks like my best bet for getting this project off the ground. Focus on designing an interface that I can do local reasoning about, then port the tests to handle that interface.

Here's where I am on that currently:

Hopefully in a week or so, I'll be able to put up the very, very early prototype code for public consumption. Nothing else to be done right now, though.

Good night.