Commit Graph

41 Commits

Author SHA1 Message Date
practicalswift
4b0571bae8 [gardening] Fix documentation typos 2016-01-24 12:52:01 +01:00
Tomohiro Kumagai
473b15648a [docs] Replace old-style array type annotations. 2016-01-13 04:09:39 +09:00
Tomohiro Kumagai
e4bf75fb29 [stdlib] [docs] Re-wrap some paragraphs to fit within 80 characters. #936 2016-01-12 11:09:15 +09:00
Tomohiro Kumagai
01155076fa [stdlib] [docs] Modify Array's type parameter name and rename Slice to ArraySlice in comments.
In swift 1.2, `Slice` has been renamed  `ArraySlice`.
In swift 2.0, type parameter name of `Array` is changed from `T` to `Element`.
Therefore, modified the names which appear in code comments and a document.
2016-01-11 17:04:45 +09:00
Dave Abrahams
e3eea5f740 Revert "Update Arrays.rst" 2015-12-13 22:51:11 -08:00
Himank Yadav
138a2fa257 Update Arrays.rst 2015-12-13 08:28:03 -06:00
Ted Kremenek
76621aac1f Merge pull request #61 from d-soni/master
fixed various docs typos
2015-12-03 10:36:24 -08:00
Devin Soni
fe1aee3117 fixed capitalization in note for consistency 2015-12-03 13:24:00 -05:00
ksaldana1
ca1a45ad30 fixed typo in docs/tools/Arrays.rst 2015-12-03 12:15:31 -06:00
Erik Eckstein
33d7324161 Removed/changed some outdated info in the Arrays.rst document.
Swift SVN r31317
2015-08-18 23:23:43 +00:00
Erik Eckstein
4306502d0f Update graphics in array doc.
The new graphics reflects the current implementation of Array.
(I added the .graffle file long time ago, but it was never referenced from the rst file).



Swift SVN r31311
2015-08-18 22:02:19 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Dave Abrahams
9a13a7148b [stdlib] Consolidate bridging protocols
Squash _[Conditionally]BridgedToObjectiveC into one protocol.  This
change results in simpler bridging code with fewer dynamic protocol
conformance checks, and solves the nasty naming/semantics problem that
resulted from having _ConditionallyBridgedToObjectiveC refining
_BridgedToObjectiveC.

Also, rename things so they're more symmetrical and less confusing.

Swift SVN r20664
2014-07-29 01:30:27 +00:00
Dave Abrahams
d00e888d95 [stdlib] Rename reinterpretCast => unsafeBitCast
Also give unsafeBitCast an explicit type parameter.  So

  let x: T = reinterpretCast(y)

becomes

  let x = unsafeBitCast(y, T.self)

Swift SVN r20487
2014-07-24 13:17:36 +00:00
Jordan Rose
836c9d6eb4 Rename -Ofast to -Ounchecked.
<rdar://problem/17202004>

Swift SVN r20454
2014-07-24 01:12:56 +00:00
Dmitri Hrybenko
4c4f83fb52 stdlib: underscore-prefix requirements of _BridgedToObjectiveCType and
_ConditionallyBridgedToObjectiveCType protocols

rdar://17283639


Swift SVN r20079
2014-07-17 09:42:19 +00:00
Doug Gregor
e47b0c220f Address Dmitri's review comments
Swift SVN r19047
2014-06-20 13:57:00 +00:00
Doug Gregor
22dc55058e Make bridgeFromObjectiveC return non-optional.
Now that we use bridgeFromObjectiveCConditional to perform conditional
bridging, make bridgeFromObjectiveC handle forced bridging. For the
latter, deferred checking is acceptable.

Almost all of <rdar://problem/17319154>.


Swift SVN r19046
2014-06-20 13:15:41 +00:00
Dave Abrahams
5e9c2b40f0 [docs] ReST fixup
Swift SVN r18246
2014-05-17 06:39:31 +00:00
Dave Abrahams
3fbfd0ab4b [docs] Revise the Array bridge/cast story
This change makes the story more coherent and consistent, and most
importantly, verifiable.  I've pushed ContiguousArray and Slice out of
the bridge/cast picture in order to simplify the description of Array.
Writing the story for those other array types (someday) in terms of this
one should be straightforward.

Swift SVN r18229
2014-05-17 00:17:16 +00:00
Dave Abrahams
cff11a4cad [docs] Rename NativeArray => ContiguousArray
Per API review feedback.  Code changes are to come.

Swift SVN r18138
2014-05-15 23:24:01 +00:00
Dave Abrahams
88ef28ad2a [docs] clarify downcast semantics
I was previously reading this as, "if you don't have an ArrayBuffer<U>,
downcast fails in O(1)."  We actually want it to fall through to
deferred in that case.

Swift SVN r18137
2014-05-15 23:24:00 +00:00
Dave Abrahams
1601b19b81 [docs] Arrays.rst - clarify deferred bridging
Also turn italic terminology references into links.

Swift SVN r18095
2014-05-15 02:13:42 +00:00
Dave Abrahams
897a11fda4 [stdlib] Update Arrays doc
Removed a meaningless bullet and call out an O(N) where it appears

Swift SVN r18074
2014-05-14 16:44:49 +00:00
Dave Abrahams
47eea01ab8 [stdlib] Eager non-verbatim bridging
Trying to lazily compute bridge results and cache them isn't going to
work, because there's no place to efficiently invalidate the cache in
cases like this:

  func f(a: NSArray) {
    for i in 0...a.count {
      println(a.objectAtIndex(i)) // Fills up the cache
    }
  }

  var message = ["hello", "world"]
  f(message)
  message[0] = "goodbye, cruel" // need a cache invalidation or else
  f(message)                    // ...this prints "hello\nworld\n"

Since we need C performance for subscript assignment, we just can't
afford to do anything extra there.

Instead, when the element type isn't "Bridged Verbatim," just eagerly
convert it to an NSArray.

Swift SVN r17722
2014-05-08 23:02:08 +00:00
Dave Abrahams
dea14570b9 [stdlib] Array doc adjustment
We were wishfully thinking that we could convert all NSArrays lazily.
However, since non-class/existential types are supposed to have a
statically-knowable efficient representation we need an eager conversion
in those cases.

Swift SVN r17538
2014-05-06 07:52:58 +00:00
Dave Abrahams
555674633a [stdlib] Array bridging specification tweaks
Chris suggested that we should lazily typecheck each element when an
NSArray is downcast to Array<T>.  That sounded like a good idea, and
along the way we decided to simplify the implementation and spec by not
bending over backwards to allow broken duck-typing to work for pure ObjC
classes.

Swift SVN r17468
2014-05-05 17:52:58 +00:00
Michael Gottesman
1e7d7fb85f Revert "[stdlib] Array bridging specification tweaks"
This reverts commit r17408.

Swift SVN r17417
2014-05-05 04:05:36 +00:00
Dave Abrahams
a86aecd6fe [stdlib] Array bridging specification tweaks
Chris suggested that we should lazily typecheck each element when an
NSArray is downcast to Array<T>.  That sounded like a good idea, and
along the way we decided to simplify the implementation and spec by not
bending over backwards to allow broken duck-typing to work for pure ObjC
classes.

Swift SVN r17408
2014-05-04 23:16:06 +00:00
Dave Abrahams
dd6b0f7144 [stdlib] More Array doc updates
There's little point in allowing Array<T> to have both direct and
indirect representations when T can be a class type.  Let's drop the
branch cost and generate less code.

Swift SVN r17353
2014-05-04 01:32:54 +00:00
Dave Abrahams
18d12fa234 [stdlib] One more note about Array casting
Swift SVN r17324
2014-05-03 19:51:52 +00:00
Dave Abrahams
5e045b4453 [stdlib] Limit array casts to Array<T>
There's no need to support up- or down-casts for NativeArray<T> or
Slice<T>.  Slice might turn out to be easy, but we don't have time right
now.  Doing it for NativeArray<T> would have efficiency costs that we
don't want to pay.

Swift SVN r17323
2014-05-03 19:49:53 +00:00
Dave Abrahams
9cf3eefb8c [stdlib] Array bridging doc update
This thing is freakin' complicated!  We're going to have to find a
reasonable subset to implement for WWDC.

Swift SVN r17308
2014-05-03 03:53:55 +00:00
Dave Abrahams
2c0a803afe [docs] Updated information on Array casts
Swift SVN r17303
2014-05-03 02:07:14 +00:00
Dave Abrahams
a3bc9b6cb0 [stdlib] Array doc update
Swift SVN r17302
2014-05-03 02:07:14 +00:00
Dave Abrahams
98274bd5d3 [docs] Update Arrays.rst
This is a partial update.  We need to decide how to rework array
up-/down-casting to account for value semantics changes.  Will post to
the list.

Swift SVN r17254
2014-05-02 16:30:14 +00:00
Ted Kremenek
5ad769ec0b Rename the BridgedToObjectiveC protocol to _BridgedToObjectiveC or _BridgedToObjC.
For now we're going to keep BridgedToObjectiveC as a private internal
implementation detail.  Adding the "_" prefix marks it as internal.

Implements <rdar://problem/16736672>.

Swift SVN r16921
2014-04-27 06:07:25 +00:00
Dave Abrahams
06e720257e [stdlib] Array docs: use normal bullets
The funny bullets used by our stylesheet don't paste well into emails.
Also, clean up an editorial comment

Swift SVN r16185
2014-04-10 23:37:24 +00:00
Dave Abrahams
2da97e2736 [stdlib] Array docs: correctness fix
Optional<T>.map doesn't unwrap inner optionals, so have to rephrase.

Swift SVN r16184
2014-04-10 23:18:26 +00:00
Dave Abrahams
ecda8ab966 [stdlib] Array docs: typo fix
Swift SVN r16182
2014-04-10 23:13:15 +00:00
Dave Abrahams
38d73b2b96 [stdlib] Initial docs for the new Array design
Swift SVN r16181
2014-04-10 23:10:33 +00:00