| OLD | NEW |
| 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 All the APIs defined in this documentation, unless explicitly called |
| 10 type-check it, and, if the argument's value is the wrong type, then it | 10 out as being in a framework, are in the `dart:sky` built-in module. |
| 11 must throw an ArgumentError as follows: | 11 |
| 12 When a method in `dart:sky` defined as ``external`` receives an |
| 13 argument, it must type-check it, and, if the argument's value is the |
| 14 wrong type, then it must throw an ArgumentError as follows: |
| 12 | 15 |
| 13 throw new ArgumentError(value, name: name); | 16 throw new ArgumentError(value, name: name); |
| 14 | 17 |
| 15 ...where "name" is the name of the argument. | 18 ...where "name" is the name of the argument. Type checking here |
| 16 | 19 includes rejecting nulls unless otherwise indicated or unless null is |
| 17 Further, if the type of the argument is annotated with ``@nonnull``, | 20 argument's default value. |
| 18 then the method must additionally throw if the value is of type Null, | |
| 19 as follows: | |
| 20 | |
| 21 throw new ArgumentError.notNull(name); | |
| 22 | |
| 23 The ``@nonnull`` annotation is defined as follows: | |
| 24 | |
| 25 ```dart | |
| 26 const nonnull = const Object(); | |
| 27 ``` | |
| 28 | |
| 29 The ``@nonnull`` annotation does nothing in code not marked | |
| 30 ``external``, but it has been included anyway for documentation | |
| 31 purposes. It indicates places where providing a null is a contract | |
| 32 violation and that results are therefore likely to be poor. | |
| 33 | 21 |
| 34 The following definitions are exposed in ``dart:sky``: | 22 The following definitions are exposed in ``dart:sky``: |
| 35 | 23 |
| 36 ```dart | 24 ```dart |
| 37 abstract class AutomaticMetadata { | 25 abstract class AutomaticMetadata { |
| 38 const AutomaticMetadata(); | 26 const AutomaticMetadata(); |
| 39 void init(DeclarationMirror target, Module module); | 27 void init(DeclarationMirror target, Module module); |
| 40 | 28 |
| 41 static void runLibrary(LibraryMirror library, Module module) { | 29 static void runLibrary(LibraryMirror library, Module module) { |
| 42 library.declarations.values.toList()..sort((DeclarationMirror a, Declaration
Mirror b) { | 30 library.declarations.values.toList()..sort((DeclarationMirror a, Declaration
Mirror b) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 to a superclass' constructor, wherein the subclass' constructor has | 86 to a superclass' constructor, wherein the subclass' constructor has |
| 99 the same arguments as the superclass' constructor and does nothing | 87 the same arguments as the superclass' constructor and does nothing |
| 100 but invoke that superclass' constructor with the same arguments. The | 88 but invoke that superclass' constructor with the same arguments. The |
| 101 syntax for defining this is, within the class body for a class | 89 syntax for defining this is, within the class body for a class |
| 102 called ClassName: | 90 called ClassName: |
| 103 | 91 |
| 104 ```dart | 92 ```dart |
| 105 ClassName = SuperclassName; | 93 ClassName = SuperclassName; |
| 106 ClassName.namedConstructor = SuperclassName.otherNamedConstructor; | 94 ClassName.namedConstructor = SuperclassName.otherNamedConstructor; |
| 107 ``` | 95 ``` |
| OLD | NEW |