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

feat(starlib): util.Marshal extended compatibility and tests #34

Merged
merged 1 commit into from
Jul 8, 2019
Merged

feat(starlib): util.Marshal extended compatibility and tests #34

merged 1 commit into from
Jul 8, 2019

Conversation

mcuadros
Copy link
Contributor

@mcuadros mcuadros commented Jul 8, 2019

I was working on a encoding/yaml module and I found that util.Marshal lacks some types support. I added the coverage of this types plus a test for it.

Also I believe that can be useful introduce support for an interface like:

type StarkarkMarshaller interface {
   AsStarlark() starlark.Value
}

To allow conversion from any type and not just the standard ones.

@mcuadros mcuadros changed the title util: Marshal extended compatibility and tests feat(starlib): util.Marshal extended compatibility and tests Jul 8, 2019
@b5 b5 self-requested a review July 8, 2019 23:05
@b5 b5 added the feat label Jul 8, 2019
Copy link
Member

@b5 b5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for the additional tests & case types!

@b5
Copy link
Member

b5 commented Jul 8, 2019

Really into the idea of an AsStarlark interface @mcuadros. To me the question is where to put such an interface. It may warrant turning encoding into a go package that declares this interface. I'd love to think on it more, but agree AsStarlark is a great idea

@b5 b5 merged commit 7f4ba90 into qri-io:master Jul 8, 2019
@mcuadros
Copy link
Contributor Author

mcuadros commented Jul 8, 2019

Yep, could be worth do a library with Marshal, I have a similar code in my project as for sure many other people will ending doing the same kind of code.

@gebv
Copy link
Contributor

gebv commented Apr 7, 2020

Is StarkarkMarshaller that supported already? Is this issue stale?
Any ideas for Unmarshaller? Global registry for custom types (factroy)?

@b5
Copy link
Member

b5 commented Apr 7, 2020

hi @gebv! This is a merged pull request, the functionality described above is now part of the codebase, if you're in need of an Unmarshaler interface, we'd be delighted if you could file an issue describing your use case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants