{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift/pulls/comments/56104032","id":56104032,"diff_hunk":"@@ -925,91 +925,57 @@ extension String {\n }\n \n // Index conversions\n-extension String.Index {\n-  /// Construct the position in `characters` that corresponds exactly to\n-  /// `unicodeScalarIndex`. If no such position exists, the result is `nil`.\n-  ///\n-  /// - Precondition: `unicodeScalarIndex` is an element of\n-  ///   `characters.unicodeScalars.indices`.\n-  public init?(\n-    _ unicodeScalarIndex: String.UnicodeScalarIndex,\n-    within characters: String\n-  ) {\n-    if !unicodeScalarIndex._isOnGraphemeClusterBoundary {\n-      return nil\n-    }\n-    self.init(_base: unicodeScalarIndex)\n-  }\n-\n-  /// Construct the position in `characters` that corresponds exactly to\n-  /// `utf16Index`. If no such position exists, the result is `nil`.\n-  ///\n-  /// - Precondition: `utf16Index` is an element of\n-  ///   `characters.utf16.indices`.\n-  public init?(\n-    _ utf16Index: String.UTF16Index,\n-    within characters: String\n-  ) {\n-    if let me = utf16Index.samePosition(\n-      in: characters.unicodeScalars\n-    )?.samePosition(in: characters) {\n-      self = me\n-    }\n-    else {\n-      return nil\n-    }\n-  }\n-\n-  /// Construct the position in `characters` that corresponds exactly to\n-  /// `utf8Index`. If no such position exists, the result is `nil`.\n-  ///\n-  /// - Precondition: `utf8Index` is an element of\n-  ///   `characters.utf8.indices`.\n-  public init?(\n-    _ utf8Index: String.UTF8Index,\n-    within characters: String\n-  ) {\n-    if let me = utf8Index.samePosition(\n-      in: characters.unicodeScalars\n-    )?.samePosition(in: characters) {\n-      self = me\n-    }\n-    else {\n-      return nil\n-    }\n-  }\n-\n-  /// Returns the position in `utf8` that corresponds exactly\n-  /// to `self`.\n-  ///\n-  /// - Precondition: `self` is an element of `String(utf8).indices`.\n+extension String {\n+  // TODO: swift-3-indexing-model - add docs\n   @warn_unused_result\n-  public func samePosition(\n-    in utf8: String.UTF8View\n-  ) -> String.UTF8View.Index {\n-    return String.UTF8View.Index(self, within: utf8)\n+  public func convert(\n+    index index: String.UTF8Index,\n+    from view: String.UTF8View\n+  ) -> String.Index? {","path":"stdlib/public/core/String.swift","position":72,"original_position":72,"commit_id":"715ec8c2667750bd1ace43dcc6de1a9088aa10d1","original_commit_id":"715ec8c2667750bd1ace43dcc6de1a9088aa10d1","user":{"login":"gribozavr","id":1120569,"avatar_url":"https://avatars.githubusercontent.com/u/1120569?v=3","gravatar_id":"","url":"https://api.github.com/users/gribozavr","html_url":"https://github.com/gribozavr","followers_url":"https://api.github.com/users/gribozavr/followers","following_url":"https://api.github.com/users/gribozavr/following{/other_user}","gists_url":"https://api.github.com/users/gribozavr/gists{/gist_id}","starred_url":"https://api.github.com/users/gribozavr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gribozavr/subscriptions","organizations_url":"https://api.github.com/users/gribozavr/orgs","repos_url":"https://api.github.com/users/gribozavr/repos","events_url":"https://api.github.com/users/gribozavr/events{/privacy}","received_events_url":"https://api.github.com/users/gribozavr/received_events","type":"User","site_admin":false},"body":"> or did you mean the following?\r\n\r\nSorry, you're right, that's what I meant.\r\n\r\n> I may standardize on this as an interim step to see if and when we may need both buffers.\r\n\r\nSounds good!","created_at":"2016-03-15T01:32:41Z","updated_at":"2016-03-15T01:32:41Z","html_url":"https://github.com/apple/swift/pull/1666#discussion_r56104032","pull_request_url":"https://api.github.com/repos/apple/swift/pulls/1666","_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/comments/56104032"},"html":{"href":"https://github.com/apple/swift/pull/1666#discussion_r56104032"},"pull_request":{"href":"https://api.github.com/repos/apple/swift/pulls/1666"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/1666","id":62677890,"html_url":"https://github.com/apple/swift/pull/1666","diff_url":"https://github.com/apple/swift/pull/1666.diff","patch_url":"https://github.com/apple/swift/pull/1666.patch","issue_url":"https://api.github.com/repos/apple/swift/issues/1666","number":1666,"state":"open","locked":false,"title":"WIP (no merge) New indexing model: updated String.UnicodeScalarIndex","user":{"login":"shawnce","id":352255,"avatar_url":"https://avatars.githubusercontent.com/u/352255?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnce","html_url":"https://github.com/shawnce","followers_url":"https://api.github.com/users/shawnce/followers","following_url":"https://api.github.com/users/shawnce/following{/other_user}","gists_url":"https://api.github.com/users/shawnce/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnce/subscriptions","organizations_url":"https://api.github.com/users/shawnce/orgs","repos_url":"https://api.github.com/users/shawnce/repos","events_url":"https://api.github.com/users/shawnce/events{/privacy}","received_events_url":"https://api.github.com/users/shawnce/received_events","type":"User","site_admin":false},"body":"@gribozavr @austinzheng \r\n\r\nIn support of removing lingering uses of successor and predecessor I took a first pass at modifying String.UnicodeScalarIndex to the new model and updating affected code. I also attempted to lay a possible code structure for things that existed in an index and that now should exist at the view level.\r\n\r\nNote this PR builds on #1653 so ignore the changes coming from those commits (will disappear if and when that other PR is merged).\r\n\r\nWe still need to rework UTF8View.Index and CharacterView.Index and related code. Also a handful of things need to be implement (fatalError(\"FIXME: swift-3-indexing-model: implement\")) across the String cluster of structs.\r\n\r\n-----\r\n- converted String.UnicodeScalarIndex to a simple Int based index\r\n- removed samePosition and conversion initializers from all String\r\nIndexes\r\n- added convert(index: String.XxxIndex, from: String.XxxxView) ->\r\nString.YyyyIndex to replace samePosition functionality\r\n- moved UnicodeScalarView related measurement / boundary into\r\nUnicodeScalarView and out of indexes\r\n- …more to go with the remaining String indexes","created_at":"2016-03-13T18:00:45Z","updated_at":"2016-03-15T01:32:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"168d9f93953fc392dd66029d6e4cdc6b4fbcf0e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift/pulls/1666/commits","review_comments_url":"https://api.github.com/repos/apple/swift/pulls/1666/comments","review_comment_url":"https://api.github.com/repos/apple/swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift/issues/1666/comments","statuses_url":"https://api.github.com/repos/apple/swift/statuses/715ec8c2667750bd1ace43dcc6de1a9088aa10d1","head":{"label":"shawnce:swift-3-indexing-model-string-indexes","ref":"swift-3-indexing-model-string-indexes","sha":"715ec8c2667750bd1ace43dcc6de1a9088aa10d1","user":{"login":"shawnce","id":352255,"avatar_url":"https://avatars.githubusercontent.com/u/352255?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnce","html_url":"https://github.com/shawnce","followers_url":"https://api.github.com/users/shawnce/followers","following_url":"https://api.github.com/users/shawnce/following{/other_user}","gists_url":"https://api.github.com/users/shawnce/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnce/subscriptions","organizations_url":"https://api.github.com/users/shawnce/orgs","repos_url":"https://api.github.com/users/shawnce/repos","events_url":"https://api.github.com/users/shawnce/events{/privacy}","received_events_url":"https://api.github.com/users/shawnce/received_events","type":"User","site_admin":false},"repo":{"id":47999652,"name":"swift","full_name":"shawnce/swift","owner":{"login":"shawnce","id":352255,"avatar_url":"https://avatars.githubusercontent.com/u/352255?v=3","gravatar_id":"","url":"https://api.github.com/users/shawnce","html_url":"https://github.com/shawnce","followers_url":"https://api.github.com/users/shawnce/followers","following_url":"https://api.github.com/users/shawnce/following{/other_user}","gists_url":"https://api.github.com/users/shawnce/gists{/gist_id}","starred_url":"https://api.github.com/users/shawnce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shawnce/subscriptions","organizations_url":"https://api.github.com/users/shawnce/orgs","repos_url":"https://api.github.com/users/shawnce/repos","events_url":"https://api.github.com/users/shawnce/events{/privacy}","received_events_url":"https://api.github.com/users/shawnce/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shawnce/swift","description":"The Swift Programming Language","fork":true,"url":"https://api.github.com/repos/shawnce/swift","forks_url":"https://api.github.com/repos/shawnce/swift/forks","keys_url":"https://api.github.com/repos/shawnce/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shawnce/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shawnce/swift/teams","hooks_url":"https://api.github.com/repos/shawnce/swift/hooks","issue_events_url":"https://api.github.com/repos/shawnce/swift/issues/events{/number}","events_url":"https://api.github.com/repos/shawnce/swift/events","assignees_url":"https://api.github.com/repos/shawnce/swift/assignees{/user}","branches_url":"https://api.github.com/repos/shawnce/swift/branches{/branch}","tags_url":"https://api.github.com/repos/shawnce/swift/tags","blobs_url":"https://api.github.com/repos/shawnce/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shawnce/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shawnce/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/shawnce/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shawnce/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/shawnce/swift/languages","stargazers_url":"https://api.github.com/repos/shawnce/swift/stargazers","contributors_url":"https://api.github.com/repos/shawnce/swift/contributors","subscribers_url":"https://api.github.com/repos/shawnce/swift/subscribers","subscription_url":"https://api.github.com/repos/shawnce/swift/subscription","commits_url":"https://api.github.com/repos/shawnce/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/shawnce/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/shawnce/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/shawnce/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/shawnce/swift/contents/{+path}","compare_url":"https://api.github.com/repos/shawnce/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shawnce/swift/merges","archive_url":"https://api.github.com/repos/shawnce/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shawnce/swift/downloads","issues_url":"https://api.github.com/repos/shawnce/swift/issues{/number}","pulls_url":"https://api.github.com/repos/shawnce/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/shawnce/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/shawnce/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shawnce/swift/labels{/name}","releases_url":"https://api.github.com/repos/shawnce/swift/releases{/id}","deployments_url":"https://api.github.com/repos/shawnce/swift/deployments","created_at":"2015-12-14T20:32:42Z","updated_at":"2016-02-21T06:24:28Z","pushed_at":"2016-03-14T17:33:45Z","git_url":"git://github.com/shawnce/swift.git","ssh_url":"git@github.com:shawnce/swift.git","clone_url":"https://github.com/shawnce/swift.git","svn_url":"https://github.com/shawnce/swift","homepage":"https://swift.org/","size":78923,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:swift-3-indexing-model","ref":"swift-3-indexing-model","sha":"a9d91dc965f104d35e0a87c707088bb14f27ccd2","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":44838949,"name":"swift","full_name":"apple/swift","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift","description":"The Swift Programming Language","fork":false,"url":"https://api.github.com/repos/apple/swift","forks_url":"https://api.github.com/repos/apple/swift/forks","keys_url":"https://api.github.com/repos/apple/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift/teams","hooks_url":"https://api.github.com/repos/apple/swift/hooks","issue_events_url":"https://api.github.com/repos/apple/swift/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift/events","assignees_url":"https://api.github.com/repos/apple/swift/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift/tags","blobs_url":"https://api.github.com/repos/apple/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift/languages","stargazers_url":"https://api.github.com/repos/apple/swift/stargazers","contributors_url":"https://api.github.com/repos/apple/swift/contributors","subscribers_url":"https://api.github.com/repos/apple/swift/subscribers","subscription_url":"https://api.github.com/repos/apple/swift/subscription","commits_url":"https://api.github.com/repos/apple/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift/merges","archive_url":"https://api.github.com/repos/apple/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift/downloads","issues_url":"https://api.github.com/repos/apple/swift/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift/deployments","created_at":"2015-10-23T21:15:07Z","updated_at":"2016-03-15T00:25:14Z","pushed_at":"2016-03-15T01:28:27Z","git_url":"git://github.com/apple/swift.git","ssh_url":"git@github.com:apple/swift.git","clone_url":"https://github.com/apple/swift.git","svn_url":"https://github.com/apple/swift","homepage":"https://swift.org/","size":108066,"stargazers_count":27617,"watchers_count":27617,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3603,"mirror_url":null,"open_issues_count":60,"forks":3603,"open_issues":60,"watchers":27617,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/1666"},"html":{"href":"https://github.com/apple/swift/pull/1666"},"issue":{"href":"https://api.github.com/repos/apple/swift/issues/1666"},"comments":{"href":"https://api.github.com/repos/apple/swift/issues/1666/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift/pulls/1666/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift/pulls/1666/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift/statuses/715ec8c2667750bd1ace43dcc6de1a9088aa10d1"}}}}