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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/specs/modules.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/specs/script.md
diff --git a/sky/specs/script.md b/sky/specs/script.md
index debe791d8e0963f8dde39b1ffd002984a4a5aa7e..10d673bb119a8f45f28de7048209f7753ad7eecb 100644
--- a/sky/specs/script.md
+++ b/sky/specs/script.md
@@ -30,3 +30,78 @@ The ``@nonnull`` annotation does nothing in code not marked
``external``, but it has been included anyway for documentation
purposes. It indicates places where providing a null is a contract
violation and that results are therefore likely to be poor.
+
+The following definitions are exposed in ``sky:core``:
+
+```dart
+abstract class AutomaticMetadata {
+ const AutomaticMetadata();
+ void init(DeclarationMirror target) { }
+}
+
+/*
+class AutomaticFunction extends AutomaticMetadata {
+ const AutomaticFunction();
+ void init(DeclarationMirror target) {
+ assert(target is MethodMirror);
+ MethodMirror f = target as MethodMirror;
+ assert(!f.isAbstract);
+ assert(f.isRegularMethod);
+ assert(f.isTopLevel);
+ assert(f.isStatic);
+ assert(f.parameters.length == 0);
+ assert(f.returnType == currentMirrorSystem().voidType);
+ (f.owner as LibraryMirror).invoke(f.simpleName, []);
+ }
+}
+const autorun = const AutomaticFunction();
+*/
+```
+
+Extensions
+----------
+
+The following as-yet unimplemented features of the Dart language are
+assumed to exist:
+
+* It is assumed that a subclass can define a constructor by reference
+ to a superclass' constructor, wherein the subclass' constructor has
+ the same arguments as the superclass' constructor and does nothing
+ but invoke that superclass' constructor with the same arguments. The
+ syntax for defining this is, within the class body for a class
+ called ClassName:
+
+```dart
+ ClassName = SuperclassName;
+ ClassName.namedConstructor = SuperclassName.otherNamedConstructor;
+```
+
+* It is assumed that the standard library includes something that
+ matches this pattern:
+
+```dart
+class DispatcherController<T> {
+ Dispatcher<T> _dispatcher;
+ Dispatcher<T> get dispatcher => _dispatcher;
+
+ void add(T data) {
+ // ...
+ }
+}
+typedef bool Filter<T>(T t);
+typedef void Handler<T>(T t);
+class Dispatcher<T> {
+ Dispatcher<T> where(Filter<T> filter) { /*...*/ return this; }
+ void listen(Handler<T> handler) { /* ... */ }
+}
+class ExceptionListException<T> extends Exception with IterableMixin<T> {
+ List<T> _exceptions;
+ void add(T exception) {
+ if (_exceptions == null)
+ _exceptions = new List<T>();
+ _exceptions.add(exception);
+ }
+ int get length => _exceptions == null ? 0 : _exceptions.length;
+ Iterator<T> iterator() => _exceptions.iterator();
+}
+```
« 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