Coding 2024-02-21
Okay, here we are, still dealing with whatever is going on in my head, sinuses, and wherever else. I just threw together some validation code that should prevent my generator script from doing something weird in the face of a malicious pickle. This is, I think, somewhere between hard and impossible to handle in the general case, but in this case, I'm specifically looking for a set of strings, so, like, I think there's less than a dozen opcodes that are valid for that purpose.
The next thing I want to consider is how to handle all of the wrapper-type classes I wrote. Currently, they have attributes that refer to the "child" classes, and keeping that would mean that the nodes would have to be converted eagerly. This seems a little unreasonable when it comes to the case of "convert just part of the tree for spellcheck purposes". In that context, it's sort of justifiable to make the top level lazy, but I don't know which rationale wins at the lower levels:
- All use cases will require the whole thing eventually
- Doing it all lazily is more consistent
- Something about performance characteristics from allocating a bunch of memory up front versus interleaving more kinds of operations later
I'm going to figure "calculating things on the fly means I can add new attributes as properties, instead of as more code in a constructor function". So, on the one hand, I know which way I want to go forward. On the other hand, I've been thinking about this long enough that now it's late and I really want to get to bed.
Good night.