OLD | NEW |
(Empty) | |
| 1 Smoke (and mirrors) |
| 2 =================== |
| 3 |
| 4 Smoke is a package that exposes a reduced reflective system API. This API |
| 5 includes accessing objects in a dynamic fashion (read properties, write |
| 6 properties, and call methods), inspecting types (for example, whether a |
| 7 method exists), and symbol/string convertion. |
| 8 |
| 9 The package provides a default implementation of this API that uses the system's |
| 10 mirrors, but additionally provides mechanisms for statically generating code |
| 11 that can replace the mirror-based implementation. |
| 12 |
| 13 The intention of this package is to allow frameworks to use mirrors in a way |
| 14 that will not impose on their users. The idea is that users will not worry about |
| 15 how to preserve symbols when compiling with dart2js (for instance, using the |
| 16 [MirrorsUsed][] annotation). Instead, this package provides the building |
| 17 blocks to autogenerate whatever is needed for dart2js to be happy and to |
| 18 generate reasonable code. |
| 19 |
| 20 Note this package alone doesn't know how to generate everything, but it provides |
| 21 a simple API that different frameworks can use to define what needs to be |
| 22 generated. |
| 23 |
| 24 |
| 25 Smoke reflective API |
| 26 ==================== |
| 27 |
| 28 Use `package:smoke/smoke.dart` in your framework to read and write objects and |
| 29 to inspect type information. Read the Dart-docs for more details. |
| 30 |
| 31 Code Generation |
| 32 =============== |
| 33 |
| 34 Use `package:smoke/codegen/generator.dart` and |
| 35 `package:smoke/codegen/recorder.dart` in your transformer to create a static |
| 36 initialization that can be used by smoke. The test under |
| 37 `test/codegen/end_to_end_test.dart` is a good illustrating example to learn how |
| 38 to use these APIs. |
| 39 |
| 40 [MirrorsUsed]: https://api.dartlang.org/apidocs/channels/stable/#dart-mirrors.Mi
rrorsUsed |
OLD | NEW |