Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Passing in codecs instead of identifiers #197

Open
vmx opened this issue Mar 19, 2019 · 0 comments
Open

Passing in codecs instead of identifiers #197

vmx opened this issue Mar 19, 2019 · 0 comments

Comments

@vmx
Copy link
Member

vmx commented Mar 19, 2019

The current API takes multicodec codes as parameter for formats. @Gozala proposes #191 (comment) to pass in codec instances:

I find passing name / code of the codec counter intuitive & I think just providing a codec instance might be better for following reasons:

  1. Type checkers / linters can catch mismatching / invalid references, but are useless with names.
  2. If codec has not being installed you get an error, while with say dag.put(node, dag.codec[name]) you are encourage to see if format is known.
  3. Don't necessarily need to install codec to use it.

I understand that without installing a codec / format decode will not work, however get could optionally take codec as well. In case of putMany / getMany it's less clear but maybe optional codec dict can be provided as in {[name]:Codec}.

Not a big deal, just in my code I find it more convenient to pass actual codecs than names.

@vmx vmx mentioned this issue Mar 19, 2019
15 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant