Oddbean new post about | logout
 well defined by WHO is the reason

that should just be in the library you are using, so go ask them that question

this is how i did it in my fork of fiatjaf's go-nostr:

https://github.com/mleku/realy/blob/dev/kind/kind.go#L79

there is a forward index with symbols just below it that are named, some have synonyms because there is a couple of different ways to refer to it, and on the other side, there is a map and a mutex so it can be safely accessed concurrently with the function on the line shown there, from a reverse dictionary

i could probably change it into a generated form, so there is a simple one way lexicon and then programmatically generates the reverse lookup

this gives you a string you can get based on the number of the kind, and in reverse, you can use the name to refer to the kind as a symbol such as `kind.MemoryHole` which can give you the number with `kind.MemoryHole.Number`

writing a canonical, text formatted version of this would not be a bad idea, and i could then pull the latest version of it and update my table from it

i'm happy with how it is now though, but if you have the time to sit down and define the some 150 or so kinds that have been defined, and trawl all the pull requests and issues to find others that may be in early stages of being refined, you would be doing us all a service to help formalise it

it's just not that important, the majority of ones that a client needs to know about are specific to each module of the app that is being built, and the relays barely even need to know, i actually put all this in for debugging reasons more than anything else