You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to resurrect a Go implementation (since go-multicodec is deprecated and archived), I went through multiple phases of what a multicodec library should look like. Only after talking to other members of the IPLD team I came to the conclusion that many of my initial ideas weren't great.
For example, exposing the entire table in an implementation is a bad idea. The table will grow over time, so it will mean higher costs such as memory usage, binary size, and compile time.
Similarly, categorizing the names or codes is not a good idea. The table has a tag field, but it doesn't mean that each of the codes fits neatly into a single category which will remain stable over time. I initially had the idea to give named constants different types in Go to separate the categories and avoid using the wrong type of code, but that turns out to be a bad idea.
Another pitfall would be to implement all of the multicodecs as part of the library, such as via external dependencies. This would mean that importing the multicodec library would suddenly pull hundreds of indirect dependencies, whereas the user likely only needs a tiny minority.
So it seems like the general recommendation should be to just expose a series of named constants for each of the codes. For example, in Go, we could simply code generate:
I'm not sure. This list of constants would correspond to the entire list in the multicodec spec, which is why I was assuming that go-multicodec should be called package multicodec. Calling it ipldcodec would be a bit inconsistent given what the other libraries in the rest of the languages are called, no?
While trying to resurrect a Go implementation (since go-multicodec is deprecated and archived), I went through multiple phases of what a multicodec library should look like. Only after talking to other members of the IPLD team I came to the conclusion that many of my initial ideas weren't great.
For example, exposing the entire table in an implementation is a bad idea. The table will grow over time, so it will mean higher costs such as memory usage, binary size, and compile time.
Similarly, categorizing the names or codes is not a good idea. The table has a
tag
field, but it doesn't mean that each of the codes fits neatly into a single category which will remain stable over time. I initially had the idea to give named constants different types in Go to separate the categories and avoid using the wrong type of code, but that turns out to be a bad idea.Another pitfall would be to implement all of the multicodecs as part of the library, such as via external dependencies. This would mean that importing the multicodec library would suddenly pull hundreds of indirect dependencies, whereas the user likely only needs a tiny minority.
So it seems like the general recommendation should be to just expose a series of named constants for each of the codes. For example, in Go, we could simply code generate:
The main advantage here would be that code would be self-explanatory; instead of having:
we'd have just:
I think this could be a brief section under "Implementations". I imagine that the general recommendations would apply to most languages.
The text was updated successfully, but these errors were encountered: