diff options
author | Per Lilja <perlilja@gmail.com> | 2015-10-21 13:28:36 +0200 |
---|---|---|
committer | Per Lilja <perlilja@gmail.com> | 2015-10-21 13:28:36 +0200 |
commit | 3f8b067a0cace44bb43bdd08561b0efc747fb26c (patch) | |
tree | 1e17c3f1968f7b2f97ea9f84ca0098224ff60786 /hack.html.markdown | |
parent | d1a822f96c88855b2cbb649a4ea7b452e4104164 (diff) | |
parent | ef6973b13f50063462d28a96ac57e93aed40844c (diff) |
Merge pull request #1 from adambard/master
Update fork
Diffstat (limited to 'hack.html.markdown')
-rw-r--r-- | hack.html.markdown | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/hack.html.markdown b/hack.html.markdown index b9730dc0..b3d19f8e 100644 --- a/hack.html.markdown +++ b/hack.html.markdown @@ -51,7 +51,7 @@ function identity(?string $stringOrNull) : ?string class TypeHintedProperties { public ?string $name; - + protected int $id; private float $score = 100.0; @@ -91,7 +91,7 @@ function openBox(Box<int> $box) : int // Shapes -// +// // Hack adds the concept of shapes for defining struct-like arrays with a // guaranteed, type-checked set of keys type Point2D = shape('x' => int, 'y' => int); @@ -108,7 +108,7 @@ distance( // Type aliasing -// +// // Hack adds a bunch of type aliasing features for making complex types readable newtype VectorArray = array<int, Vector<int>>; @@ -142,7 +142,7 @@ function getRoadType() : RoadType // Constructor argument promotion -// +// // To avoid boilerplate property and constructor definitions that only set // properties, Hack adds a concise syntax for defining properties and a // constructor at the same time. @@ -171,12 +171,12 @@ class WithoutArgumentPromotion // Co-operative multi-tasking -// +// // Two new keywords "async" and "await" can be used to perform multi-tasking // Note that this does not involve threads - it just allows transfer of control async function cooperativePrint(int $start, int $end) : Awaitable<void> { - for ($i = $start; $i <= $end; $i++) { + for ($i = $start; $i <= $end; $i++) { echo "$i "; // Give other tasks a chance to do something @@ -193,9 +193,9 @@ AwaitAllWaitHandle::fromArray([ // Attributes -// +// // Attributes are a form of metadata for functions. Hack provides some -// special built-in attributes that introduce useful behaviour. +// special built-in attributes that introduce useful behaviour. // The __Memoize special attribute causes the result of a function to be cached <<__Memoize>> @@ -248,7 +248,7 @@ class ConsistentBar extends ConsistentFoo class InvalidFooSubclass extends ConsistentFoo { // Not matching the parent constructor will cause a type checker error: - // + // // "This object is of type ConsistentBaz. It is incompatible with this object // of type ConsistentFoo because some of their methods are incompatible" // @@ -259,7 +259,7 @@ class InvalidFooSubclass extends ConsistentFoo // Using the __Override annotation on a non-overriden method will cause a // type checker error: - // + // // "InvalidFooSubclass::otherMethod() is marked as override; no non-private // parent definition found or overridden parent is defined in non-<?hh code" // |