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

variable-length-quantity: I don't think returning number of bytes decoded is necessary #683

Closed
petertseng opened this issue May 23, 2017 · 0 comments

Comments

@petertseng
Copy link
Member

Since it was introduced in #322, the decode function returns the number of bytes decoded. The creator of the exercise mentioned that it was to be consistent with the standard library's API. I am not sure right now, but I guess it would be something similar to https://golang.org/pkg/io/#Writer or something?

Now, since #674, it is required that the entire input array be decoded, or else it is an error. I would say now that the number of bytes to decode doesn't make much sense to return, since now it is known that it will always be the length of the input array. If you want an standard library example, https://golang.org/pkg/encoding/json/#Unmarshal doesn't return number of bytes decoded.

I will probably do this myself in a little over 24 hours but can't now, so it's a reminder for me to do.

petertseng added a commit that referenced this issue Jun 2, 2017
Since it was introduced in #322, the decode function returns the number
of bytes decoded. The creator of the exercise mentioned that it was to
be consistent with the standard library's API.

Go standard library example for returning number of bytes:
https://golang.org/pkg/io/#Writer

Now, since #674, it is required that the entire input array be decoded,
or else it is an error. Now the number of bytes decoded doesn't make
much sense to return, since now it is known that it will always be the
length of the input.

Go standard library example for not returning number of bytes (decoding
everything):
https://golang.org/pkg/encoding/json/#Unmarshal

testVersion -> 4

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

No branches or pull requests

1 participant