diff --git a/specs/builtins.md b/specs/builtins.md
new file mode 100644
index 0000000000000000000000000000000000000000..90ac3dbc3f5a8e23e200ea7dccf30395693e4227
--- /dev/null
+++ b/specs/builtins.md
@@ -0,0 +1,112 @@
+Built-In Elements
+=================
+
+```dart
+SKY MODULE
+
+
+```
diff --git a/specs/events.md b/specs/events.md
index 8210e7f04a17e6bbb97fbc31c3b6959bf9a4954a..70cc866104df6ab701c35187d88c0f0ee0d9da7d 100644
--- a/specs/events.md
+++ b/specs/events.md
@@ -31,12 +31,6 @@ class DispatcherController {
void add(T data) => dispatcher._add(data);
}
-class Pair {
- const Pair(this.a, this.b);
- final A a;
- final B b;
-}
-
class Dispatcher {
List> _listeners;
void listen(Handler handler) {
diff --git a/specs/runloop.md b/specs/runloop.md
index a9b9e9e0d51a45353c92d234d571cfdec7569a12..b080090af1b1d6b4e2fe487d21d4fd569b36bbe2 100644
--- a/specs/runloop.md
+++ b/specs/runloop.md
@@ -11,6 +11,18 @@ fired.
class DeadlineExceededException implements Exception { }
```
+There is a method you can use that guards your code against these
+exceptions:
+
+```dart
+typedef void Callback();
+external guardAgainstDeadlineExceptions(Callback callback);
+// runs callback.
+// if the time budget for the _task_ expires while the callback is
+// running, the callback isn't interrupted, but the method will throw
+// an exception once the callback returns.
+```
+
When Sky is to *process a task queue until a particular time*, with a
queue *relevant task queue*, bits *filter bits*, a time
*particular time*, and an *idle rule* which is either "sleep" or
diff --git a/specs/style2.md b/specs/style2.md
index 7cf8ba22a1bc9f02dd6ff24f6eaf39351601a740..1a2cec2db3cc3ec47154a3bf68878f8212a58156 100644
--- a/specs/style2.md
+++ b/specs/style2.md
@@ -1,8 +1,9 @@
Sky Style Language
==================
-Note: This is a work in progress that will eventually replace
-(style.md)[style.md].
+This is a trimmed down version of the API in (style.md)[style.md]
+that is intended to be a stepping stone to the long-term world where
+there are no hard-coded properties in the engine.
The Sky style API looks like the following:
@@ -57,17 +58,6 @@ The dart:sky library contains the following to define this API:
import 'dart:mirrors';
import 'dart:math';
-class WeakMap {
- // This is not actually a weak map right now, because Dart doesn't let us have weak references.
- // We should fix that, or else we're going to keep alive every object you ever tear off through
- // the StyleDeclaration API, even if you never use it again, until the StyleDeclaration object
- // itself is GC'ed, which is likely when the element is GC'ed, which is likely never.
- Map _map = new Map();
- operator[](Key key) => _map[key];
- operator[]=(Key key, Value value) => _map[key] = value;
- bool containsKey(Key key) => _map.containsKey(key);
-}
-
typedef void StringSetter(Symbol propertySymbol, StyleDeclaration declaration, String value);
typedef String StringGetter(Symbol propertySymbol, StyleDeclaration declaration);
typedef Property ObjectConstructor(Symbol propertySymbol, StyleDeclaration declaration);
@@ -119,7 +109,7 @@ class StyleDeclaration {
}
// some properties expose dedicated APIs so you don't have to use string manipulation
- WeakMap _properties = new WeakMap();
+ MapOfWeakReferences _properties = new MapOfWeakReferences();
noSuchMethod(Invocation invocation) {
Symbol propertySymbol;
if (invocation.isSetter) {
@@ -178,14 +168,17 @@ abstract class Property {
throw new ArgumentError(value);
}
- void setter(dynamic value) {
- if (value == initial)
- return _setInitial();
- if (value == inherit)
- return _setInitial();
- if (value == null)
- return _unset();
- throw new ArgumentError(value);
+ void setter(dynamic newValue) {
+ switch (newValue) {
+ case initial:
+ _setInitial();
+ case inherit:
+ _setInherit();
+ case null:
+ _unset();
+ default:
+ throw new ArgumentError(value);
+ }
}
external bool _isInitial();
diff --git a/specs/utils.md b/specs/utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..de8da83ba75f775d9894cfa2ae7ffd9bd4a729dc
--- /dev/null
+++ b/specs/utils.md
@@ -0,0 +1,22 @@
+Dart Utilities Used By dart:sky
+===============================
+
+The classes defined here are used internally by dart:sky but are
+pretty generic.
+
+```dart
+class Pair {
+ const Pair(this.a, this.b);
+ final A a;
+ final B b;
+ int get hashCode => a.hashCode ^ b.hashCode;
+ bool operator==(other) => other is Pair && a == other.a && b == other.b;
+}
+
+// MapOfWeakReferences can be implemented in C, using the C Dart API, apparently
+class MapOfWeakReferences {
+ external operator[](Key key);
+ external operator[]=(Key key, Value value);
+ external bool containsKey(Key key);
+}
+```