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

Side by Side Diff: pkg/lookup_map/README.md

Issue 1320503003: dart2js: add initial support for lookup-maps (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/lookup_map/LICENSE ('k') | pkg/lookup_map/lib/lookup_map.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Lookup maps
2
3 This package contains the definition of `LookupMap`: a simple, but very
4 restricted map. The map can only hold constant keys and the only way to use the
5 map is to retrieve values with a key you already have. Expect for lookup, any
Ivan Posva 2015/09/08 15:52:10 Expect or except?
Siggi Cherem (dart-lang) 2015/09/08 16:00:00 good catch, thanks!
6 other operation in `Map` (like forEach, keys, values, length, etc) is not
7 available.
8
9 Constant `LookupMap`s are understood by dart2js and can be tree-shaken
10 internally: if a key is not used elsewhere in the program, its entry can be
11 deleted from the map during compilation without changing the program's behavior.
12 Currently dart2js supports tree-shaking keys that are Type literals, and any
13 const expression that can only be created with a const constructor. This means
14 that primitives, Strings, and constant objects that override the `==` operator
15 cannot be tree-shaken.
16
17
18 ## Examples
19
20 `LookupMap` is unlikely going to be useful for individual developers writing
21 code by hand. It is mainly intended as a helper utility for frameworks that need
22 to autogenerate data and associate it with a type in the program. For example,
23 this can be used by a dependency injection system to record how to create
24 instances of a given type. A dependency injection framework can store in a
25 `LookupMap` all the information it needs for every injectable type in every
26 library and package. When compiling a specific application, dart2js can
27 tree-shake the data of types that are not used by the application. Similarly,
28 this can also be used by serialization/deserialization packages that can store
29 in a `LookupMap` the deserialization logic for a given type.
OLDNEW
« no previous file with comments | « pkg/lookup_map/LICENSE ('k') | pkg/lookup_map/lib/lookup_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698