{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift/pulls/comments/47301338","id":47301338,"diff_hunk":"@@ -0,0 +1,45 @@\n+//===----------------------------------------------------------------------===//\n+//\n+// This source file is part of the Swift.org open source project\n+//\n+// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors\n+// Licensed under Apache License v2.0 with Runtime Library Exception\n+//\n+// See http://swift.org/LICENSE.txt for license information\n+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors\n+//\n+//===----------------------------------------------------------------------===//\n+\n+// Generate comparison functions for tuples up to some reasonable arity.\n+\n+% for arity in range(2,7):\n+%   typeParams = [chr(ord(\"A\")+i) for i in range(arity)]\n+%   tupleT = \"({})\".format(\",\".join(typeParams))\n+\n+%   equatableTypeParams = \", \".join([\"{}: Equatable\".format(c) for c in typeParams])\n+\n+@warn_unused_result\n+public func == <${equatableTypeParams}>(lhs: ${tupleT}, rhs: ${tupleT}) -> Bool {\n+%   ops = [\"lhs.{} == rhs.{}\".format(i,i) for i in range(arity)]\n+  return ${\" && \".join(ops)}\n+}\n+\n+@warn_unused_result\n+public func != <${equatableTypeParams}>(lhs: ${tupleT}, rhs: ${tupleT}) -> Bool {\n+%   ops = [\"lhs.{} != rhs.{}\".format(i,i) for i in range(arity)]\n+  return ${\" || \".join(ops)}\n+}\n+\n+%   comparableTypeParams = \", \".join([\"{}: Comparable\".format(c) for c in typeParams])\n+%   for op in [\"<\", \">\"]:\n+%     for opeq in [\"\", \"=\"]:\n+@warn_unused_result\n+public func ${op}${opeq} <${comparableTypeParams}>(lhs: ${tupleT}, rhs: ${tupleT}) -> Bool {\n+%   for i in range(arity-1):\n+  if lhs.${i} != rhs.${i} { return lhs.${i} ${op} rhs.${i} }\n+%   end\n+  return lhs.${arity-1} ${op}${opeq} rhs.${arity-1}","path":"stdlib/public/core/Tuple.swift.gyb","position":41,"original_position":41,"commit_id":"41bd040effb727b56d17d5c079a530bacd6dccbb","original_commit_id":"41bd040effb727b56d17d5c079a530bacd6dccbb","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":"As a code size optimization, you could try defining one operators in terms of others.","created_at":"2015-12-10T23:13:01Z","updated_at":"2015-12-10T23:13:01Z","html_url":"https://github.com/apple/swift/pull/408#discussion_r47301338","pull_request_url":"https://api.github.com/repos/apple/swift/pulls/408","_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/comments/47301338"},"html":{"href":"https://github.com/apple/swift/pull/408#discussion_r47301338"},"pull_request":{"href":"https://api.github.com/repos/apple/swift/pulls/408"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/408","id":53328714,"html_url":"https://github.com/apple/swift/pull/408","diff_url":"https://github.com/apple/swift/pull/408.diff","patch_url":"https://github.com/apple/swift/pull/408.patch","issue_url":"https://api.github.com/repos/apple/swift/issues/408","number":408,"state":"open","locked":false,"title":"Implement tuple comparison operators","user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"body":"This is an implementation of apple/swift-evolution#45 for tuples of arities 2–6.","created_at":"2015-12-10T22:43:59Z","updated_at":"2015-12-10T23:13:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e54774ff312110107cf71d966133426b5fc0b6e8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift/pulls/408/commits","review_comments_url":"https://api.github.com/repos/apple/swift/pulls/408/comments","review_comment_url":"https://api.github.com/repos/apple/swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift/issues/408/comments","statuses_url":"https://api.github.com/repos/apple/swift/statuses/41bd040effb727b56d17d5c079a530bacd6dccbb","head":{"label":"kballard:tuple-comparison-ops","ref":"tuple-comparison-ops","sha":"41bd040effb727b56d17d5c079a530bacd6dccbb","user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"repo":{"id":47383591,"name":"swift","full_name":"kballard/swift","owner":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kballard/swift","description":"The Swift Programming Language","fork":true,"url":"https://api.github.com/repos/kballard/swift","forks_url":"https://api.github.com/repos/kballard/swift/forks","keys_url":"https://api.github.com/repos/kballard/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kballard/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kballard/swift/teams","hooks_url":"https://api.github.com/repos/kballard/swift/hooks","issue_events_url":"https://api.github.com/repos/kballard/swift/issues/events{/number}","events_url":"https://api.github.com/repos/kballard/swift/events","assignees_url":"https://api.github.com/repos/kballard/swift/assignees{/user}","branches_url":"https://api.github.com/repos/kballard/swift/branches{/branch}","tags_url":"https://api.github.com/repos/kballard/swift/tags","blobs_url":"https://api.github.com/repos/kballard/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kballard/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kballard/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/kballard/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kballard/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/kballard/swift/languages","stargazers_url":"https://api.github.com/repos/kballard/swift/stargazers","contributors_url":"https://api.github.com/repos/kballard/swift/contributors","subscribers_url":"https://api.github.com/repos/kballard/swift/subscribers","subscription_url":"https://api.github.com/repos/kballard/swift/subscription","commits_url":"https://api.github.com/repos/kballard/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/kballard/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/kballard/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/kballard/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/kballard/swift/contents/{+path}","compare_url":"https://api.github.com/repos/kballard/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kballard/swift/merges","archive_url":"https://api.github.com/repos/kballard/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kballard/swift/downloads","issues_url":"https://api.github.com/repos/kballard/swift/issues{/number}","pulls_url":"https://api.github.com/repos/kballard/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/kballard/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/kballard/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kballard/swift/labels{/name}","releases_url":"https://api.github.com/repos/kballard/swift/releases{/id}","created_at":"2015-12-04T05:37:18Z","updated_at":"2015-12-04T05:37:45Z","pushed_at":"2015-12-10T22:42:56Z","git_url":"git://github.com/kballard/swift.git","ssh_url":"git@github.com:kballard/swift.git","clone_url":"https://github.com/kballard/swift.git","svn_url":"https://github.com/kballard/swift","homepage":"","size":58934,"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:master","ref":"master","sha":"21f081fc1af8d4c5169a8cf48bafd0d8011abfce","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}","created_at":"2015-10-23T21:15:07Z","updated_at":"2015-12-10T23:03:37Z","pushed_at":"2015-12-10T22:56:07Z","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":"","size":73969,"stargazers_count":22433,"watchers_count":22433,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2628,"mirror_url":null,"open_issues_count":50,"forks":2628,"open_issues":50,"watchers":22433,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/408"},"html":{"href":"https://github.com/apple/swift/pull/408"},"issue":{"href":"https://api.github.com/repos/apple/swift/issues/408"},"comments":{"href":"https://api.github.com/repos/apple/swift/issues/408/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift/pulls/408/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift/pulls/408/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift/statuses/41bd040effb727b56d17d5c079a530bacd6dccbb"}}}}