33
33
2. It should be possible to receive an ``NSArray `` from Cocoa,
34
34
represent it as an ``Array<AnyObject> ``, and pass it right back to
35
35
Cocoa as an ``NSArray `` in O(1) and with no memory allocations.
36
-
36
+
37
37
3. Arrays should be usable as stacks, so we want amortized O(1) append
38
38
and O(1) popBack. Together with goal #1, this implies a
39
39
``std::vector ``\ -like layout, with a reserved tail memory capacity
@@ -141,7 +141,7 @@ Bridging Rules and Terminology for all Types
141
141
* For a type ``T `` that is not `bridged verbatim `_,
142
142
143
143
- if ``T `` conforms to ``BridgedToObjectiveC `` and either
144
-
144
+
145
145
- ``T `` does not conform to ``_ConditionallyBridgedToObjectiveC ``
146
146
- or, ``T._isBridgedToObjectiveC() ``
147
147
@@ -182,7 +182,7 @@ conforms to ``_BridgedToObjectiveC``:
182
182
* **Implicit conversions ** between ``Array `` types
183
183
184
184
- **Implicit upcasting ** implicitly converts ``Derived[] `` to
185
- ``Base[] `` in O(1).
185
+ ``Base[] `` in O(1).
186
186
- **Implicit bridging ** implicitly converts ``X[] `` to
187
187
``X._ObjectiveCType[] `` in O(N).
188
188
@@ -202,7 +202,7 @@ conforms to ``_BridgedToObjectiveC``:
202
202
For example, when a user writes a Swift method taking ``NSView[] ``,
203
203
it is exposed to Objective-C as a method taking ``NSArray ``, which
204
204
is force-converted to ``NSView[] `` when called from Objective-C.
205
-
205
+
206
206
- **Forced downcasting ** converts ``AnyObject[] `` to ``Derived[] `` in
207
207
O(1)
208
208
- **Forced bridging back ** converts ``AnyObject[] `` to ``X[] `` in O(N).
@@ -250,7 +250,7 @@ buffer; it will be copied upon its first mutation:
250
250
251
251
.. _deferred :
252
252
253
- Deferrred Checking for Forced Downcasts
253
+ Deferred Checking for Forced Downcasts
254
254
.......................................
255
255
256
256
In forced downcasts, if any element fails to have dynamic type ``Derived ``,
0 commit comments