Coding 2023-02-12
It can be a bad sign when, while working on code in one language, you try to replicate the behavior of another language. Different languages make different tradeoffs, and this (hopefully) guides the design of what is easy to accomplish in that language. Attempts to import behavior from another context are likely to produce inefficiencies, or even bugs.
So anyway, I've drafted an implementation of Python-tuple-like objects in pure Lua.
...
That's it. That's the joke.
...
Anyway, sure, maybe all of these attempts at immutability are kind of pointless if I'm not going to be changing stuff, but it does also cache the immutable value, which means that identical calls will produce the same table, so hashing and equality will work the way I want them to.
Here's what I want to do next with this code:
- Fix up the "frozen class" draft to use this new "frozen array" code.
- Figure out how to integrate this with the "enum class" code.
- Roll that out where I'm using enum classes currently.
- Also, update some of the enum classes to make proper use of the "class" side of things.
- I should really bake some reasonable stringification logic into classes somehow. Maybe add a helper function to the disinherit module that can be used to produce a __tostring value.
Anyway, I'll work on that when I feel like it. I'm trying to figure out what I'm really motivated to work on right now, and I'm not sure. I'll think about it some more, I guess.
Good night.