Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Issue 660373002: Add a QueueList class to the collection package. (Closed)

Created:
6 years, 2 months ago by nweiz
Modified:
6 years, 1 month ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add a QueueList class to the collection package. This class is based on the ListQueue implementation and implements both the Queue and List interfaces. R=lrn@google.com Committed: https://code.google.com/p/dart/source/detail?r=41467

Patch Set 1 #

Total comments: 16

Patch Set 2 : Code review changes #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+518 lines, -2 lines) Patch
M pkg/collection/CHANGELOG.md View 1 chunk +4 lines, -0 lines 0 comments Download
M pkg/collection/lib/collection.dart View 1 chunk +1 line, -0 lines 0 comments Download
A pkg/collection/lib/src/queue_list.dart View 1 1 chunk +231 lines, -0 lines 4 comments Download
M pkg/collection/pubspec.yaml View 1 chunk +1 line, -1 line 0 comments Download
A pkg/collection/test/queue_list_test.dart View 1 1 chunk +276 lines, -0 lines 0 comments Download
M sdk/lib/collection/queue.dart View 1 2 chunks +5 lines, -1 line 0 comments Download

Messages

Total messages: 12 (2 generated)
nweiz
6 years, 1 month ago (2014-10-28 21:53:54 UTC) #2
Lasse Reichstein Nielsen
lgtm I'd consider implementing setRange, and possibly other *Range methods. The setRange function is often ...
6 years, 1 month ago (2014-10-29 07:04:44 UTC) #3
Lasse Reichstein Nielsen
https://codereview.chromium.org/660373002/diff/1/pkg/collection/lib/src/queue_list.dart File pkg/collection/lib/src/queue_list.dart (right): https://codereview.chromium.org/660373002/diff/1/pkg/collection/lib/src/queue_list.dart#newcode125 pkg/collection/lib/src/queue_list.dart:125: } (But warning: Not tested!) https://codereview.chromium.org/660373002/diff/1/pkg/collection/lib/src/queue_list.dart#newcode157 pkg/collection/lib/src/queue_list.dart:157: number = ...
6 years, 1 month ago (2014-10-29 08:15:30 UTC) #4
nweiz
Code review changes
6 years, 1 month ago (2014-10-29 20:43:25 UTC) #5
nweiz
> I'd consider implementing setRange, and possibly other *Range methods. The setRange function is often ...
6 years, 1 month ago (2014-10-29 20:49:36 UTC) #6
Lasse Reichstein Nielsen
LGTM! https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/queue_list.dart File pkg/collection/lib/src/queue_list.dart (right): https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/queue_list.dart#newcode144 pkg/collection/lib/src/queue_list.dart:144: throw new RangeError("Index $index must be in the ...
6 years, 1 month ago (2014-10-31 10:07:19 UTC) #7
nweiz
https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/queue_list.dart File pkg/collection/lib/src/queue_list.dart (right): https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/queue_list.dart#newcode144 pkg/collection/lib/src/queue_list.dart:144: throw new RangeError("Index $index must be in the range ...
6 years, 1 month ago (2014-11-03 20:36:58 UTC) #8
nweiz
Committed patchset #2 (id:20001) manually as 41467 (presubmit successful).
6 years, 1 month ago (2014-11-03 20:39:33 UTC) #9
Lasse Reichstein Nielsen
https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/queue_list.dart File pkg/collection/lib/src/queue_list.dart (right): https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/queue_list.dart#newcode144 pkg/collection/lib/src/queue_list.dart:144: throw new RangeError("Index $index must be in the range ...
6 years, 1 month ago (2014-11-03 21:05:55 UTC) #10
sra1
6 years, 1 month ago (2014-11-03 21:33:51 UTC) #12
Message was sent while issue was closed.
https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/q...
File pkg/collection/lib/src/queue_list.dart (right):

https://codereview.chromium.org/660373002/diff/20001/pkg/collection/lib/src/q...
pkg/collection/lib/src/queue_list.dart:144: throw new RangeError("Index $index
must be in the range [0..$length).");
On 2014/11/03 20:36:58, nweiz wrote:
> On 2014/10/31 10:07:19, Lasse Reichstein Nielsen wrote:
> > You can use:
> >  new RangeError.range(index, 0, length - 1);
> 
> That doesn't produce a nice message when length is 0.

Lasse: I have found this to be an issue as well.

Should we have a new constructor that supports this common case?

RangeError.range has historically been used inconsistently because many (but not
all) ranges are [start,end) (half-open indexes) but RangeError.range is tailored
to [start,end] ranges (closed positions).

It is irritating to have to do arithmetic at the throw site and more code
increases the chance that another error is thrown due to a mistake in calling or
execution of the constructor.

I also believe we have missed an opportunity to make various errors more
introspectable - a RangeError could have kept the bad element as a plain value
for inspecting in the debugger, rather than interpolated into a message.  In
this case, the indexable collection should be held by the Error too, even if it
is never part of the message.

Powered by Google App Engine
This is Rietveld 408576698