Explorar o código

Update docs on data structures

Steven Silvester %!s(int64=8) %!d(string=hai) anos
pai
achega
a9b234b7da
Modificáronse 1 ficheiros con 8 adicións e 10 borrados
  1. 8 10
      tutorial/patterns.md

+ 8 - 10
tutorial/patterns.md

@@ -115,27 +115,25 @@ A getter should yield the same value every time.
 
 ## Data Structures
 
-Prefer to use Vector over JavaScript `Array` for internal use for its extra flexibility.
 
 For public API, we have three options: JavaScript `Array`, 
-`IIterator`, and `ISequence`.
+`IIterator`, and `ReadonlyArray` (an interface defined by TypeScript).
 
 Prefer an `Array` for:
+- A and that is meant to be mutable.
+
+Prefer an a `ReadonlyArray`
 - A return value is the result of a newly allocated array, to avoid the 
 extra allocation of an iterator.
-- A signal payload.
-- A public attribute that is inherently static.  Use `.slice()` to
-make sure the internal value cannot be mutated by the consumer.
+- A signal payload - since it will be consumed by multiple listeners.
+- The values may need to be accessed randomly.
+- A public attribute that is inherently static.
 
 Prefer an `IIterator` for:
-- A return value where the value is based on an internal `Vector` but the 
+- A return value where the value is based on an internal `Array` but the 
 value should not need to be accessed randomly.
 - A set of return values that can be computed lazily.
 
-Prefer an `ISequence` when:
-- A return value or public attribute based on an internal `Vector` where the 
-value may need to be accessed randomly.
-
 
 ## DOM Events