Skip to content
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

node/bindnode: support binding IPLD Any to Go interface{} aka any #338

Open
mvdan opened this issue Jan 20, 2022 · 0 comments
Open

node/bindnode: support binding IPLD Any to Go interface{} aka any #338

mvdan opened this issue Jan 20, 2022 · 0 comments
Assignees

Comments

@mvdan
Copy link
Contributor

mvdan commented Jan 20, 2022

We only support binding the schema type Any to datamodel.Node, with the understanding that it will be filled via https://pkg.go.dev/github.com/ipld/go-ipld-prime/node/basicnode.

This works, but it's also counter-intuitive. If I construct a list like []interface{}{"foo", 123}, why shouldn't I be able to use bindnode.Wrap and have it work with the schema [Any]? At the moment, I have to manually transform my []interface{} into []datamodel.Node, which is possible, but cumbersome.

This might be a reason to not use basicnode to implement Any, and instead rely on bindnode itself to construct and use the plain Go types (basic types, lists, maps). This is because basicnode hides the underlying Go values, so we wouldn't be able to easily assign them into the user's value.

cc @warpfork

@BigLep BigLep moved this to 🗄️ Backlog in IPLD team's weekly tracker Jul 19, 2022
@rvagg rvagg moved this from 🗄️ Backlog to 🥞 Todo in IPLD team's weekly tracker Aug 2, 2022
@rvagg rvagg self-assigned this Aug 2, 2022
@rvagg rvagg moved this from 🥞 Todo to 🗄️ Backlog in IPLD team's weekly tracker Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🗄️ Backlog
Development

No branches or pull requests

2 participants