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

Issue 8510066: Fix String.trim implementation (follow spec). (Closed)

Created:
9 years, 1 month ago by srdjan
Modified:
9 years, 1 month ago
Reviewers:
hausner, siva
CC:
reviews_dartlang.org, ngeoffray
Visibility:
Public.

Description

Fix String.trim implementation (follow spec). Fix Queue.every, Queue.some, Queue.filter, .. Adapt co19 status files. Committed: https://code.google.com/p/dart/source/detail?r=1521

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 8

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -26 lines) Patch
M corelib/src/implementation/queue.dart View 1 2 3 chunks +10 lines, -5 lines 0 comments Download
M runtime/lib/string.dart View 1 2 2 chunks +9 lines, -3 lines 0 comments Download
M runtime/lib/string_buffer.dart View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M tests/co19/co19-compiler.status View 1 2 1 chunk +0 lines, -4 lines 0 comments Download
M tests/co19/co19-frog.status View 1 2 1 chunk +0 lines, -4 lines 0 comments Download
M tests/co19/co19-runtime.status View 1 2 3 chunks +1 line, -9 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
srdjan
9 years, 1 month ago (2011-11-14 19:53:46 UTC) #1
srdjan
9 years, 1 month ago (2011-11-14 20:57:39 UTC) #2
siva
LGTM once comment regarding modification while iterating is addressed. http://codereview.chromium.org/8510066/diff/9/corelib/src/implementation/queue.dart File corelib/src/implementation/queue.dart (right): http://codereview.chromium.org/8510066/diff/9/corelib/src/implementation/queue.dart#newcode185 corelib/src/implementation/queue.dart:185: ...
9 years, 1 month ago (2011-11-14 21:26:17 UTC) #3
hausner
LGTM but I don't think the queue implementation is right yet. http://codereview.chromium.org/8510066/diff/9/corelib/src/implementation/queue.dart File corelib/src/implementation/queue.dart (right): ...
9 years, 1 month ago (2011-11-14 21:58:02 UTC) #4
srdjan
9 years, 1 month ago (2011-11-14 22:15:33 UTC) #5
http://codereview.chromium.org/8510066/diff/9/corelib/src/implementation/queu...
File corelib/src/implementation/queue.dart (right):

http://codereview.chromium.org/8510066/diff/9/corelib/src/implementation/queu...
corelib/src/implementation/queue.dart:185: entry = nextEntry;
On 2011/11/14 21:26:17, asiva wrote:
> How will this protect against somebody writing an
> 'f' that removes both entry and entry._next from the queue.

It is possible for programmers to write the closures in a non-functional way so
that the list is modified twice during one for each. It is much rarer situation
than the typical usage, and closure itself cannot modify the list, only the
entry.

Filed a bug for ConcurrentModification clarification (442)

> 
> Shouldn't we just throw some kind of ConcurrentModification Exception when we
> detect that the code modifies a collection directly while it is iterating over
> the collection.

http://codereview.chromium.org/8510066/diff/9/corelib/src/implementation/queu...
corelib/src/implementation/queue.dart:185: entry = nextEntry;
On 2011/11/14 21:58:02, hausner wrote:
> I agree with Siva's comment. Probably need to have some sort of mutation count
> or something.
> 

Filed bug 442 for clarification of modification behavior.

> On 2011/11/14 21:26:17, asiva wrote:
> > How will this protect against somebody writing an
> > 'f' that removes both entry and entry._next from the queue.
> > 
> > Shouldn't we just throw some kind of ConcurrentModification Exception when
we
> > detect that the code modifies a collection directly while it is iterating
over
> > the collection.
>

http://codereview.chromium.org/8510066/diff/9/runtime/lib/string.dart
File runtime/lib/string.dart (right):

http://codereview.chromium.org/8510066/diff/9/runtime/lib/string.dart#newcode175
runtime/lib/string.dart:175: for (int i = last; last >= first; last--) {
On 2011/11/14 21:58:02, hausner wrote:
> what is this definition of int i good for? Just a reflex of the programmer
after
> wrinting "for (" :)

Removed int i"

http://codereview.chromium.org/8510066/diff/9/runtime/lib/string.dart#newcode180
runtime/lib/string.dart:180: if ((first == 0) && (last == len - 1)) {
On 2011/11/14 21:26:17, asiva wrote:
> (len - 1)

Done.

Powered by Google App Engine
This is Rietveld 408576698