-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
approach to constants #137
Comments
I think it's probably reasonable to switch over to using go-multicodec already. Having something auto-generated is very nice. On the other hand, it's another repo and another line item in If we do switch over to using go-multicodec, a few subquestions would remain:
|
would strongly suggest not having #136 block on this. I think we should spend our time on
|
Strong disagreement. These are called multicodecs and the only confusion in IPLD is that IPLD also has "codecs" (which should probably be called formats". We could call them something else (multicodes?) but it's likely too late to change them and |
I think there's a minimal subset of this issue that needs to be resolved before closing #136, or at least before doing a release of go-multihash containing #136. For example, if we're not going to be putting
Probably, it seems to me at least somewhat desirable to make more information from the code table easier for developers to access than searching through a CSV (e.g. through their development tools). Thankfully we already have the Input: (Name, Tag, Code, Description) ->
Note: we could also duplicate the code in a generic list of all codes and/or supply maps for convenience of anyone who wants to iterate through the codes.
I have no particularly strong preferences here. I get not wanting to break things when there's a totally plausible alternative where things don't break for users (e.g. just marking multicode constants as deprecated and forwarding them to the correct package). However, if a plausible and easy enough to use alternative is available pushing people in the right direction might be worthwhile. I also want to point out that breaking things might be a good idea in the event people were for some reason relying on bad behaviors (e.g. assuming that all valid multihash codes MUST be in the Names/Codes maps and that therefore failing a map check means the code number isn't a hash - like if someone manually made a copy of the ValidCode function).
Maybe, although no strong preferences from me at the moment on the naming. I get @vmx's previous suggestion of referring to items in the table as "multicodes". I think this brings us to then describing a particular code as an "x multicode", where x is effectively the tag in the multicode table (e.g. namespace, multihash, ipld, etc.). I'm not sure if those tags are totally accurate (e.g. are they "hash" codes or "multihash" codes, should the CID codes be tagged the same way as the IPLD codec codes, etc.), but perhaps it's a start 🤷. |
I believe |
@Stebalien Ya, I think you're right. Will comment in the PR |
It seems likely that we should replace many of these with values from https://github.com/multiformats/go-multicodec in the future, however, we have a new issue to track that: #137 And as noted in #136 (comment) it's time to reign in the amount of work going on in this PR.
We need to talk about how this library approaches constants.
Currently:
s/-/_/g
of the names in the multiformats table...Codes = map[uint64]string
.Names = map[string]uint64
, which is the dual ofCodes
.... so, there are numerous consistency issues with the current status quo, and it's very manual to update.
And we have a recently born go-multicodec repo, which contains a bunch of constants!
go-multiformat
. There was pretty resounding agreement that the word multicodec may be confusingly used to describe too many things the last time the IPLD team talked about this. But I also don't feel the need to hold up any other discussion this / if we do engage this, let's spawn another issue for that conversation.)And, these questions are all raised afresh by #136 -- wherein we've gotta use something for constants in various places; and the revisitation of the registration features means it's a very good time to check in on where we expect any of these mappings to string names to be handled.
Okay, that's all the background. What shall we do? Discuss.
The text was updated successfully, but these errors were encountered: