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

Side by Side Diff: sky/specs/script.md

Issue 908983002: Specs: Element registration in the Dart world (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 unified diff | Download patch
« no previous file with comments | « sky/specs/modules.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Sky Script Language 1 Sky Script Language
2 =================== 2 ===================
3 3
4 The Sky script language is Dart. 4 The Sky script language is Dart.
5 5
6 The way that Sky integrates the module system with its script language 6 The way that Sky integrates the module system with its script language
7 is described in [modules.md](modules.md). 7 is described in [modules.md](modules.md).
8 8
9 When an method defined as ``external`` receives an argument, it must 9 When an method defined as ``external`` receives an argument, it must
10 type-check it, and, if the argument's value is the wrong type, then it 10 type-check it, and, if the argument's value is the wrong type, then it
(...skipping 12 matching lines...) Expand all
23 The ``@nonnull`` annotation is defined as follows: 23 The ``@nonnull`` annotation is defined as follows:
24 24
25 ```dart 25 ```dart
26 const nonnull = const Object(); 26 const nonnull = const Object();
27 ``` 27 ```
28 28
29 The ``@nonnull`` annotation does nothing in code not marked 29 The ``@nonnull`` annotation does nothing in code not marked
30 ``external``, but it has been included anyway for documentation 30 ``external``, but it has been included anyway for documentation
31 purposes. It indicates places where providing a null is a contract 31 purposes. It indicates places where providing a null is a contract
32 violation and that results are therefore likely to be poor. 32 violation and that results are therefore likely to be poor.
33
34 The following definitions are exposed in ``sky:core``:
35
36 ```dart
37 abstract class AutomaticMetadata {
38 const AutomaticMetadata();
39 void init(DeclarationMirror target) { }
40 }
41
42 /*
43 class AutomaticFunction extends AutomaticMetadata {
44 const AutomaticFunction();
45 void init(DeclarationMirror target) {
46 assert(target is MethodMirror);
47 MethodMirror f = target as MethodMirror;
48 assert(!f.isAbstract);
49 assert(f.isRegularMethod);
50 assert(f.isTopLevel);
51 assert(f.isStatic);
52 assert(f.parameters.length == 0);
53 assert(f.returnType == currentMirrorSystem().voidType);
54 (f.owner as LibraryMirror).invoke(f.simpleName, []);
55 }
56 }
57 const autorun = const AutomaticFunction();
58 */
59 ```
60
61 Extensions
62 ----------
63
64 The following as-yet unimplemented features of the Dart language are
65 assumed to exist:
66
67 * It is assumed that a subclass can define a constructor by reference
68 to a superclass' constructor, wherein the subclass' constructor has
69 the same arguments as the superclass' constructor and does nothing
70 but invoke that superclass' constructor with the same arguments. The
71 syntax for defining this is, within the class body for a class
72 called ClassName:
73
74 ```dart
75 ClassName = SuperclassName;
76 ClassName.namedConstructor = SuperclassName.otherNamedConstructor;
77 ```
78
79 * It is assumed that the standard library includes something that
80 matches this pattern:
81
82 ```dart
83 class DispatcherController<T> {
84 Dispatcher<T> _dispatcher;
85 Dispatcher<T> get dispatcher => _dispatcher;
86
87 void add(T data) {
88 // ...
89 }
90 }
91 typedef bool Filter<T>(T t);
92 typedef void Handler<T>(T t);
93 class Dispatcher<T> {
94 Dispatcher<T> where(Filter<T> filter) { /*...*/ return this; }
95 void listen(Handler<T> handler) { /* ... */ }
96 }
97 class ExceptionListException<T> extends Exception with IterableMixin<T> {
98 List<T> _exceptions;
99 void add(T exception) {
100 if (_exceptions == null)
101 _exceptions = new List<T>();
102 _exceptions.add(exception);
103 }
104 int get length => _exceptions == null ? 0 : _exceptions.length;
105 Iterator<T> iterator() => _exceptions.iterator();
106 }
107 ```
OLDNEW
« no previous file with comments | « sky/specs/modules.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698