- 
                Notifications
    You must be signed in to change notification settings 
- Fork 196
Don't iterate iterable arguments twice in PbList #1070
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
base: master
Are you sure you want to change the base?
Conversation
| @rakudrama I can't add you as a reviewer, could you also have a look? | 
| Package publishing
 Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. | 
| With all the branching testing this becomes a quarter long engineering effort.. We need to test all combinations of: (1) when the iterable is a: PbList, List, and other Note that error conditions are already not tested today, I wouldn't be surprised if error checking is different based on the check function and argument type today. I'm inclined to do the simplest possible thing here at the cost of performance. Use a  | 
Update
PbListmethods that update the list with anIterableargument toavoid iterating the iterable twice: once for checking the element validity and
once again for actually adding the values.
Methods updated:
Exception handling behavior before this PR was undefined (same as the standard
library
List), and it's slightly changed with this PR:addAll: previously if the iterator throws the list was left unchanged, now
the elements until the exception will be added.
Other methods: exception behaviors are now the same as the standard library
Listmethods.It's hard to tell whether the previous behavior was the same or different
with the standard library
Listmethods, as the exception behavior of thoseare undefined.
To avoid allocating new iterators when a check function is not available, we
have conditionals in each of these methods and call the standard library
Listmethods directly when there isn't a check function.
Fixes #730.
cl/823443311