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

Issue 23462019: Added examples to map.dart (Closed)

Created:
7 years, 3 months ago by shailentuli
Modified:
7 years, 2 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 15

Patch Set 2 : Update based on comments by Mem #

Total comments: 13

Patch Set 3 : Minor post-LGTM changes. #

Patch Set 4 : Merge. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -9 lines) Patch
M sdk/lib/core/map.dart View 1 2 3 4 chunks +39 lines, -9 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
shailentuli
ptal
7 years, 3 months ago (2013-09-06 04:38:05 UTC) #1
mem
lovely. A few comments. https://chromiumcodereview.appspot.com/23462019/diff/1/sdk/lib/core/map.dart File sdk/lib/core/map.dart (right): https://chromiumcodereview.appspot.com/23462019/diff/1/sdk/lib/core/map.dart#newcode10 sdk/lib/core/map.dart:10: * Please show a code ...
7 years, 3 months ago (2013-09-06 16:42:22 UTC) #2
shailentuli
Another CL that Mem has looked at while you were away. ptal?
7 years, 3 months ago (2013-09-20 17:50:34 UTC) #3
shailentuli
https://chromiumcodereview.appspot.com/23462019/diff/1/sdk/lib/core/map.dart File sdk/lib/core/map.dart (right): https://chromiumcodereview.appspot.com/23462019/diff/1/sdk/lib/core/map.dart#newcode26 sdk/lib/core/map.dart:26: * where the keys and values are computed from ...
7 years, 3 months ago (2013-09-23 11:49:46 UTC) #4
shailentuli
PTAL
7 years, 3 months ago (2013-09-23 12:02:31 UTC) #5
floitsch
LGTM. just nits. https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.dart File sdk/lib/core/map.dart (right): https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.dart#newcode43 sdk/lib/core/map.dart:43: * If no values are specified ...
7 years, 3 months ago (2013-09-23 12:16:06 UTC) #6
Lasse Reichstein Nielsen
lgtm https://codereview.chromium.org/23462019/diff/7001/sdk/lib/core/map.dart File sdk/lib/core/map.dart (right): https://codereview.chromium.org/23462019/diff/7001/sdk/lib/core/map.dart#newcode9 sdk/lib/core/map.dart:9: * by using its associated key. Do we ...
7 years, 3 months ago (2013-09-24 08:29:08 UTC) #7
Kathy Walrath
lgtm A couple of comments on comments. https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.dart File sdk/lib/core/map.dart (right): https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.dart#newcode9 sdk/lib/core/map.dart:9: * by ...
7 years, 2 months ago (2013-09-25 18:11:08 UTC) #8
shailentuli
Committed patchset #4 manually as r28011 (presubmit successful).
7 years, 2 months ago (2013-09-27 14:25:45 UTC) #9
shailentuli
7 years, 2 months ago (2013-09-27 14:27:48 UTC) #10
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.dart
File sdk/lib/core/map.dart (right):

https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.da...
sdk/lib/core/map.dart:49: *     map = new Map.fromIterable(list);
On 2013/09/23 12:16:07, floitsch wrote:
> Maybe:
> Since this is not really a useful example: only provide one of the arguments?
> 
> map = new Map.fromIterable(list, value: (item) => "$item");
> map[1];  // "1"
> 
> ...

The point of the example is to show what happens if you provide no arguments.

https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.da...
sdk/lib/core/map.dart:68: *     map['b'] == 'bad' && map['c'] == 'cat';  // true
On 2013/09/23 12:16:07, floitsch wrote:
> I would prefer:
> map['b'];  // 'bad'
> map['c'];  // 'cat'

I've changed this. I generally try to avoid extremely short expressions. So, for
example, the following does not look that good to me:

List<int> list = [...];
list.sort();
list;  // [...]

It is better to make the last line something like this (as long as it doesn't
obscure the example):

list.join(', '); // ...

https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.da...
sdk/lib/core/map.dart:108: *       scores.putIfAbsent(key, () => 25);
On 2013/09/23 12:16:07, floitsch wrote:
> Maybe put an example that allocates something (or has a side-effect)?
> To show why this is a function and not just a value.

Done.

https://chromiumcodereview.appspot.com/23462019/diff/7001/sdk/lib/core/map.da...
sdk/lib/core/map.dart:114: * An error occurs if you try to add or remove keys
from the map during the
On 2013/09/25 18:11:09, Kathy Walrath wrote:
> I talked with Florian about this on another thread. We try to avoid "It is"
> because that's a weak way to open a sentence (no content at all, it's anathema
> to tech writers). Also, "It is an error" makes me think that an error will be
> thrown, and that's not true. Other ways we could put it would be:
> 
> Don't add or remove keys in [ifAbsent].
> 
> OR
> 
> The code that [ifAbsent] executes must not add or remove keys.

I'm using Kathy's version, but I'm not deeply attached to any particular
wording.

Powered by Google App Engine
This is Rietveld 408576698