-
Notifications
You must be signed in to change notification settings - Fork 18
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
Loop in a more rubyish way in Readme #14
Conversation
Ruby devs generally iterate using the more functional methods rather than setting up an index and mutating it. If this they are the target audience of this doc this would probably be clearer.
Currently, MemoryView does not have an each method, so we can not write such code. I tried to implement each method, but I can not judge whether this is suitable for MemoryView. |
Sorry, I (wrongly) assumed that memory view was just a ruby array with the data. It could be nice to define an each and include the enumerable so that transforms of the data could be defined in terms of map/reduce, but I also understand why you could have concerns around it. |
MemoryView is a large general purpose buffer, so I'm worried about the need for methods like @Hywan, could you tell us your opinion? |
I'm not familiar with Ruby idiomatic API to be totally honest. I like this patch irxground@eeaf9f7. I think it makes sense and it feels more idiomatic. About |
Thank you @Hywan. I will send a PR later. |
15: Enhance `Wasmer::XxxArray` r=Hywan a=irxground ref: #14 Now `Wasmer::XxxArray` has `each` method and include `Enumerable` module. > The Enumerable mixin provides collection classes with several traversal and searching methods, and with the ability to sort. The class must provide a method each, which yields successive members of the collection. https://docs.ruby-lang.org/en/2.6.0/Enumerable.html Co-authored-by: irxground <irxnjhtchlnrw@gmail.com>
Can we close this in favor or #15? |
This pull request is a modification of the README. PR #15 does not include that. |
@Hywan this is a doc change that was incorrect until @irxground implemented what it is documenting in #15. My personal take is this is more clear documentation for ruby devs, especially now that it is actually implemented ;-) Thanks again @irxground for figuring out the impl! |
bors r+ |
You're right, let's go :-). |
14: Loop in a more rubyish way in Readme r=Hywan a=denniscollective Ruby devs generally iterate using the more functional methods rather than setting up an index and mutating it. If this they are the target audience of this doc this would probably be clearer. Co-authored-by: Dennis Collinson <dennis.collective@gmail.com>
Build succeeded |
Thanks! |
Thank you for merging my feature-request-as-documentation ;-) |
Ruby devs generally iterate using the more functional methods rather than setting up an index and mutating it.
If this they are the target audience of this doc this would probably be clearer.