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

Unified Diff: sky/specs/modules.md

Issue 904793002: Specs: dartification of modules.md (incomplete) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/specs/modules.md
diff --git a/sky/specs/modules.md b/sky/specs/modules.md
index eddfbdb39f6269bd164eab807fcf9e3ea30ba30c..f6616cc0a12630cace9bd0c3598b7b4d9e8861c4 100644
--- a/sky/specs/modules.md
+++ b/sky/specs/modules.md
@@ -28,17 +28,46 @@ before the module it represents is marked complete.
Module API
----------
-Within a script in a module, the ``module`` identifier is bound to
-the ``Module`` object that represents the module.
+Each module consists of one or more libraries. The first library in a
+module is the *element tree library*, which imports the sky:core
+module and then consists of the following code for a Sky module:
+
+```dart
+final Module module = new Module();
+```
+
+...and the following code for a Sky application:
+
+```dart
+final Module module = new Application();
+```
+
+The ``<script>`` elements found in the document create the subsequent
+libraries. Each one first imports the ``dart:mirror`` library, then
+the ``sky:core`` module, then the first library described above, then
+all the modules referenced by ``<import>`` element up to that
+``<script>`` element and all the libraries defined by ``<script>``
+elements up to that point, interleaved so as to maintain the same
+relative order as those elements were first seen by the parser.
+
+When a library imports a module, it actually imports all the libraries
+that were declared by that module except the element tree library.
+
+At the end of the ``<script>`` block's source, if it parsed correctly
+and completely, the following code is appended:
+
+```dart
+class _ { }
+module.registerElements(reflectClass(_).owner);
+```
+
+TODO(ianh): decide what URL and name we should give the libraries, as
+exposed in MirrorSystem.getName(libraryMirror.qualifiedName) etc
+
+The ``Module`` class is defined in ``sky:core`` as follows:
-### Exporting values ###
-A module can export a value by assigning the ``exports`` property of
-its ``Module`` object. By default, the ``exports`` property of a
-``Module`` is an empty Object. Properties can be added to the object,
-or, it can be set to an entirely different object; for example, it
-could be set to the module's ``Document`` itself, in case the point of
-the module is to expose some ``template`` elements.
+TODO(ianh): dartification of the rest of this file
### Exporting element definitions ###
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698