Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Exposing vector_add to zok frontend #78
base: master
Are you sure you want to change the base?
Exposing vector_add to zok frontend #78
Changes from 12 commits
66438fb
b1cceff
f9619f4
a3d1f2f
49576d2
47fbdb8
3a065c0
123e691
d976738
8887be7
7057117
e246ddc
04d9785
c8608b3
47c0a40
8c5d3f7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're going to implement the
into_iter
function, you should implement thestd::iter::IntoIterator
trait, not just add a member function.Continuing my crusade against unnecessary cloning: you probably want
impl<'a> IntoIterator for &'a Array
, i.e., not a consuming iterator---just one that returns references. So I think what you really want is something like this (untested---seeimpl<'a, K, V> IntoIterator for &'a BTreeMap<K, V>
in the stdlib):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A second, higher-level comment: it's extremely un-idiomatic for an
into_iter
function to take&self
rather thanself
. This may seem slightly counterintuitive given what I've just said in my prior comment, but notice in my proposedimpl IntoIterator
that the argument tofn into_iter
isself
---it's just that we think ofself
as being a value of type&'a Array
.In contrast, what is currently implemented in the PR takes
&self
and then clones it to produce a by-value iterator, which is bad because it means that if someone didthey will have potentially caused a very expensive clone that they didn't expect (because idiomatically, into_iter never clones---it either consumes a value or it takes a reference and returns references).
Does this make sense?