Implementation of TypeID in Lua

move most notes into my blog post

Changed files
+6 -13
+6 -13
README.md
··· 13 13 It works and has reasonable tests, including passing the TypeID suite. 14 14 It's probably not idiomatic Lua. 15 15 16 + I've written up some notes on the implementation and alternatives in the [announcement blog post](https://push.cx/typeid-in-lua). 17 + 16 18 17 19 # Use 18 20 ··· 62 64 47 successes / 0 failures / 0 errors / 0 pending : 0.019008 seconds 63 65 ``` 64 66 65 - 66 - # Ideas 67 + # Likely Issues 67 68 68 - * I experimented with style. 69 - `TypeID` is more OO style, `Base32` and `UUID7` work on primitives. 70 - After implementing, I guess users would probably prefer getting a primitive back, despite the lack of types. 71 - * The nested conversions in the metatable `uuid` function suggests the internal representation of `suffix` is wrong, 72 - but the syntactic distinction between `.field` and `:method()` means duplicating the data into two fields, exposing the internal representation by it being a field and the other a method, or getting away from what seems like common struct-y style and making both methods. 73 - I don't really know what level to aim at between "nice consistent high-level interface" and "damn everything, all primitives and seams showing for perf". 74 69 * The rockspec probably does not correctly depend on `sys/time.h`. 75 - * I ported Base32 from the official TypeID Golang implementation then wrote UUID7 in bytes to match it, 76 - but all that intermediate bit twiddling could be simplified by generating a UUID7 directly into the Base32 encoding. 77 - * Maybe I'm looking under the wrong name, but it seems odd there isn't a bitfield type I could use, given Lua's popularity in games. 78 - Some searching turned up [a library](https://github.com/JohnHind/Lua_Bitfield) but the absence of multi-bit operations seems inconvenient. 79 - * Spec says "Implementations SHOULD allow encoding/decoding of other UUID variants" but does not mandate validating them, so I don't. 70 + * I don't understand why `luarocks` generated the version `0.1-1`, what is the `-1` for? 71 + Is my version `0.1` or `0.1-1`? 72 + * The TypeID spec says "Implementations SHOULD allow encoding/decoding of other UUID variants" but does not mandate validating them, so I don't. 80 73 Perhaps the spec should say implementations should not permit any old 128 bits.