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

Fix return type of encode_sample #164

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix return type of encode_sample #164

wants to merge 2 commits into from

Conversation

omus
Copy link
Member

@omus omus commented May 3, 2024

Broke off this non-breaking change from #163

@omus omus requested a review from kleinschmidt May 3, 2024 19:50
Copy link
Member

@kleinschmidt kleinschmidt left a comment

Choose a reason for hiding this comment

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

is this non-breaking? it's possible currently working coudl could error if the results storage is allocated with a different type than S here.

I'm also not totally clear what the intended scope of this function is. it seems like it's only used internally, and the conversion is implicit in the normal use case of encode which pre-allocates results storage of the appropriate type if encoding is necessary...

@omus
Copy link
Member Author

omus commented May 3, 2024

is this non-breaking? it's possible currently working coudl could error if the results storage is allocated with a different type than S here.

I'm also not totally clear what the intended scope of this function is. it seems like it's only used internally, and the conversion is implicit in the normal use case of encode which pre-allocates results storage of the appropriate type if encoding is necessary...

It's hard to know the author's intent on this non-exported, non-documented, non-tested function. I would say though based upon the first argument being a type the intent is to return a value of type S. Only in the case where S === Float32 could you see this issue come up and you are correct in practise those using encode! wouldn't see encounter any issue as an automatic convert happened for them. I do think this is non-breaking.

@omus omus requested a review from jrevels May 7, 2024 13:40
@omus
Copy link
Member Author

omus commented May 7, 2024

@jrevels would be good to also get your review on this PR as you are the original author.

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

Successfully merging this pull request may close these issues.

2 participants