3 ms·
Take any problem where the naturals are a good conceptual fit, and there probably exists an alternate reality where you didn't have enough power to push back on
by hansvm 2y ago
Take any problem where the naturals are a good conceptual fit, and there probably exists an alternate reality where you didn't have enough power to push back on insane design decisions, and in that reality ordinals are a good fit. The features you're likely to care about include (a) being able to reference an abstract entity instead of the thing itself (like an auto-incrementing database index referring to the knowledge atom in question) and (b) caring about some sort of ordering on those things (else you'd use uuids or some similar abomination and move on with your life).
For some spitballed examples:
1. You can get low-contention, globally unique database keys for "free" by allowing ordinal indices. Management commands like creating a table instance on a given cluster node give that table instance a unique id through some scheme involving adding infinite ordinals, and that table instance is then able to assign guaranteed unique ids ad infinitum. The sort order on keys naturally clusters time-correlated data per table, which is a hugely desirable property when reasoning about the distributed behemoth you're creating (more applicable to the DB author perhaps than an end user).
2. Priority queues are often a good start for a sequence of tasks you'd like to accomplish. Start with the idea that older things should finish first. We'll add bigger and bigger "low priority" numbers to new tasks. Continue to find that you actually have different task types, and "Bob the ML engineer" has zero access to the TPUs, the general public has mid-priority access through Colab, and Sundar has infinite priority; if he wants to dabble in ML then all the real work needs to pause. And so on. As you add more levels of order to "the next thing that should run," the system gets substantially more complicated. God forbid you need a higher priority and there are none left. Starting in some infinite middle of a stream of ordinals gives you the power to handle all that garbage without much thought. Your task queue can be pretty generic and just care about ordinal arithmetic, not the to/from steps for creating those ordinals.
1a. The database index idea is probably not usable in the real world for perf reasons, but when object counts are in the low billions you have a lot more flexibility. Imagine a VCS using ordinal arithmetic to give you perfect information just from the id of the chain of branching and commits that led you to where you are (in structure, obviously not grabbing the metadata like commit messages while magically not hitting disk).
3. Not a "working programmer" concern, but type checking, SAT solving, theorem proving, ..., tend to be fairly deeply connected. The idea of using ordinals to track and analyze recursive calls has been around for awhile. Similar techniques, even when not explicitly ported to those other domains yet, are likely to end up there eventually IMO.
- philzook 2y agoThese are really interesting suggestions.
- eru 2y agoAbout (3) ordinary working programmers expect their type checkers to just work. But that's very similar to how ordinary working programmers expect their priority queue libraries and their data base indices to just work, too.
- skybrian 2y agoThis reminds me a bit of splittable random number generators [1], which are useful for monte carlo methods with fork-join parallelism. Perhaps ordinals would be the non-random version of that? But then again, it seems like ordinals couldn’t be a fixed-size datatype like a float, so why not use dotted paths as strings? [1] https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/SplittableRandom.html https://docs.oracle.com/en/java/javase/17/docs/api/java.base...
- hansvm 2y agoThe things you gain compared to a string-based API are (a) Potentially some space efficiency. They can't be fixed-size, but they can absolutely be a small number of varints (the standard zig-zag encoded 7 bits per byte with a high-bit signalling more data would be fine, or since everything in sight is unsigned you could skip the zig-zag). (b) An intrinsic notion of order that is almost definitely correct. When the standard dictionary order suffices (actually a bit tricky with strings, starting with upper/lower-case and quickly devolving into questions of what an upper-case emoji is, but assume ASCII for the sake of argument), strings are probably a better conceptual fit. You'll struggle with the path-based approach when the number of dots changes though, when you have some concerns ordered monotonically one direction and others ordered the other way, when you need a notion of enough space to _always_ be able to slot an intermediate value in, ...