{"action":"closed","number":5362,"pull_request":{"url":"https://api.github.com/repos/livecode/livecode/pulls/5362","id":115306235,"html_url":"https://github.com/livecode/livecode/pull/5362","diff_url":"https://github.com/livecode/livecode/pull/5362.diff","patch_url":"https://github.com/livecode/livecode/pull/5362.patch","issue_url":"https://api.github.com/repos/livecode/livecode/issues/5362","number":5362,"state":"closed","locked":false,"title":"C++ style guide updates: lambdas and ternary ops","user":{"login":"peter-b","id":47528,"avatar_url":"https://avatars1.githubusercontent.com/u/47528?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-b","html_url":"https://github.com/peter-b","followers_url":"https://api.github.com/users/peter-b/followers","following_url":"https://api.github.com/users/peter-b/following{/other_user}","gists_url":"https://api.github.com/users/peter-b/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-b/subscriptions","organizations_url":"https://api.github.com/users/peter-b/orgs","repos_url":"https://api.github.com/users/peter-b/repos","events_url":"https://api.github.com/users/peter-b/events{/privacy}","received_events_url":"https://api.github.com/users/peter-b/received_events","type":"User","site_admin":false},"body":"This patch makes two small changes to the C++ coding style guide:\r\n\r\n1. For initialisation of const variables, which cannot be assigned after initialisation, it's often helpful to use a ternary expression:\r\n\r\n   ```c++\r\n   const MCObjectHandle t_found = m_values.empty() ? nullptr : m_values.front();\r\n   ```\r\n\r\n   The only other ways to do this are by moving the conditional initialisation expression into its own function or method, or to use an Immediately-Invoked Function Expression (IIFE). IIFE isn't much more attractive, but it's still _much_ better than a really complex ternary expression with more than two options.\r\n\r\n   ```c++\r\n   const MCObjectHandle t_found = [this] {\r\n           if (m_values.empty())\r\n               return MCObjectHandle{};\r\n           else\r\n               return m_values.front();\r\n       }();\r\n   ```\r\n\r\n2. C++ lambda expressions can optionally specify a return type in trailing return type syntax.  However, every compiler we use is capable of inferring the return type from `return` statements and warning about any inconsistencies.  It's probably better not to use explicit return type declaration for lambda expressions, and allow inference from `return` statements, adding casts or conversions as necessary.","created_at":"2017-04-11T12:16:42Z","updated_at":"2017-04-11T14:30:02Z","closed_at":"2017-04-11T14:30:02Z","merged_at":"2017-04-11T14:30:02Z","merge_commit_sha":"63cc1d339f68aa91bdf403c7bb5b493173418c0d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/livecode/livecode/pulls/5362/commits","review_comments_url":"https://api.github.com/repos/livecode/livecode/pulls/5362/comments","review_comment_url":"https://api.github.com/repos/livecode/livecode/pulls/comments{/number}","comments_url":"https://api.github.com/repos/livecode/livecode/issues/5362/comments","statuses_url":"https://api.github.com/repos/livecode/livecode/statuses/98ee2ac551493dedded23183e297d293c44ca994","head":{"label":"peter-b:cpp-style","ref":"cpp-style","sha":"98ee2ac551493dedded23183e297d293c44ca994","user":{"login":"peter-b","id":47528,"avatar_url":"https://avatars1.githubusercontent.com/u/47528?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-b","html_url":"https://github.com/peter-b","followers_url":"https://api.github.com/users/peter-b/followers","following_url":"https://api.github.com/users/peter-b/following{/other_user}","gists_url":"https://api.github.com/users/peter-b/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-b/subscriptions","organizations_url":"https://api.github.com/users/peter-b/orgs","repos_url":"https://api.github.com/users/peter-b/repos","events_url":"https://api.github.com/users/peter-b/events{/privacy}","received_events_url":"https://api.github.com/users/peter-b/received_events","type":"User","site_admin":false},"repo":{"id":24674939,"name":"livecode","full_name":"peter-b/livecode","owner":{"login":"peter-b","id":47528,"avatar_url":"https://avatars1.githubusercontent.com/u/47528?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-b","html_url":"https://github.com/peter-b","followers_url":"https://api.github.com/users/peter-b/followers","following_url":"https://api.github.com/users/peter-b/following{/other_user}","gists_url":"https://api.github.com/users/peter-b/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-b/subscriptions","organizations_url":"https://api.github.com/users/peter-b/orgs","repos_url":"https://api.github.com/users/peter-b/repos","events_url":"https://api.github.com/users/peter-b/events{/privacy}","received_events_url":"https://api.github.com/users/peter-b/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peter-b/livecode","description":"Peter Brett's LiveCode development repository","fork":true,"url":"https://api.github.com/repos/peter-b/livecode","forks_url":"https://api.github.com/repos/peter-b/livecode/forks","keys_url":"https://api.github.com/repos/peter-b/livecode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peter-b/livecode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peter-b/livecode/teams","hooks_url":"https://api.github.com/repos/peter-b/livecode/hooks","issue_events_url":"https://api.github.com/repos/peter-b/livecode/issues/events{/number}","events_url":"https://api.github.com/repos/peter-b/livecode/events","assignees_url":"https://api.github.com/repos/peter-b/livecode/assignees{/user}","branches_url":"https://api.github.com/repos/peter-b/livecode/branches{/branch}","tags_url":"https://api.github.com/repos/peter-b/livecode/tags","blobs_url":"https://api.github.com/repos/peter-b/livecode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peter-b/livecode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peter-b/livecode/git/refs{/sha}","trees_url":"https://api.github.com/repos/peter-b/livecode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peter-b/livecode/statuses/{sha}","languages_url":"https://api.github.com/repos/peter-b/livecode/languages","stargazers_url":"https://api.github.com/repos/peter-b/livecode/stargazers","contributors_url":"https://api.github.com/repos/peter-b/livecode/contributors","subscribers_url":"https://api.github.com/repos/peter-b/livecode/subscribers","subscription_url":"https://api.github.com/repos/peter-b/livecode/subscription","commits_url":"https://api.github.com/repos/peter-b/livecode/commits{/sha}","git_commits_url":"https://api.github.com/repos/peter-b/livecode/git/commits{/sha}","comments_url":"https://api.github.com/repos/peter-b/livecode/comments{/number}","issue_comment_url":"https://api.github.com/repos/peter-b/livecode/issues/comments{/number}","contents_url":"https://api.github.com/repos/peter-b/livecode/contents/{+path}","compare_url":"https://api.github.com/repos/peter-b/livecode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peter-b/livecode/merges","archive_url":"https://api.github.com/repos/peter-b/livecode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peter-b/livecode/downloads","issues_url":"https://api.github.com/repos/peter-b/livecode/issues{/number}","pulls_url":"https://api.github.com/repos/peter-b/livecode/pulls{/number}","milestones_url":"https://api.github.com/repos/peter-b/livecode/milestones{/number}","notifications_url":"https://api.github.com/repos/peter-b/livecode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peter-b/livecode/labels{/name}","releases_url":"https://api.github.com/repos/peter-b/livecode/releases{/id}","deployments_url":"https://api.github.com/repos/peter-b/livecode/deployments","created_at":"2014-10-01T10:49:08Z","updated_at":"2016-06-30T09:01:45Z","pushed_at":"2017-04-11T14:20:38Z","git_url":"git://github.com/peter-b/livecode.git","ssh_url":"git@github.com:peter-b/livecode.git","clone_url":"https://github.com/peter-b/livecode.git","svn_url":"https://github.com/peter-b/livecode","homepage":"http://www.livecode.com/","size":128663,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"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":"develop"}},"base":{"label":"livecode:develop","ref":"develop","sha":"886193281b86fb6cd85dd4049f2e70c9e3066e5b","user":{"login":"livecode","id":3985749,"avatar_url":"https://avatars2.githubusercontent.com/u/3985749?v=3","gravatar_id":"","url":"https://api.github.com/users/livecode","html_url":"https://github.com/livecode","followers_url":"https://api.github.com/users/livecode/followers","following_url":"https://api.github.com/users/livecode/following{/other_user}","gists_url":"https://api.github.com/users/livecode/gists{/gist_id}","starred_url":"https://api.github.com/users/livecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecode/subscriptions","organizations_url":"https://api.github.com/users/livecode/orgs","repos_url":"https://api.github.com/users/livecode/repos","events_url":"https://api.github.com/users/livecode/events{/privacy}","received_events_url":"https://api.github.com/users/livecode/received_events","type":"Organization","site_admin":false},"repo":{"id":9334445,"name":"livecode","full_name":"livecode/livecode","owner":{"login":"livecode","id":3985749,"avatar_url":"https://avatars2.githubusercontent.com/u/3985749?v=3","gravatar_id":"","url":"https://api.github.com/users/livecode","html_url":"https://github.com/livecode","followers_url":"https://api.github.com/users/livecode/followers","following_url":"https://api.github.com/users/livecode/following{/other_user}","gists_url":"https://api.github.com/users/livecode/gists{/gist_id}","starred_url":"https://api.github.com/users/livecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecode/subscriptions","organizations_url":"https://api.github.com/users/livecode/orgs","repos_url":"https://api.github.com/users/livecode/repos","events_url":"https://api.github.com/users/livecode/events{/privacy}","received_events_url":"https://api.github.com/users/livecode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/livecode/livecode","description":"LiveCode cross-platform development environment (engine)","fork":false,"url":"https://api.github.com/repos/livecode/livecode","forks_url":"https://api.github.com/repos/livecode/livecode/forks","keys_url":"https://api.github.com/repos/livecode/livecode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/livecode/livecode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/livecode/livecode/teams","hooks_url":"https://api.github.com/repos/livecode/livecode/hooks","issue_events_url":"https://api.github.com/repos/livecode/livecode/issues/events{/number}","events_url":"https://api.github.com/repos/livecode/livecode/events","assignees_url":"https://api.github.com/repos/livecode/livecode/assignees{/user}","branches_url":"https://api.github.com/repos/livecode/livecode/branches{/branch}","tags_url":"https://api.github.com/repos/livecode/livecode/tags","blobs_url":"https://api.github.com/repos/livecode/livecode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/livecode/livecode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/livecode/livecode/git/refs{/sha}","trees_url":"https://api.github.com/repos/livecode/livecode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/livecode/livecode/statuses/{sha}","languages_url":"https://api.github.com/repos/livecode/livecode/languages","stargazers_url":"https://api.github.com/repos/livecode/livecode/stargazers","contributors_url":"https://api.github.com/repos/livecode/livecode/contributors","subscribers_url":"https://api.github.com/repos/livecode/livecode/subscribers","subscription_url":"https://api.github.com/repos/livecode/livecode/subscription","commits_url":"https://api.github.com/repos/livecode/livecode/commits{/sha}","git_commits_url":"https://api.github.com/repos/livecode/livecode/git/commits{/sha}","comments_url":"https://api.github.com/repos/livecode/livecode/comments{/number}","issue_comment_url":"https://api.github.com/repos/livecode/livecode/issues/comments{/number}","contents_url":"https://api.github.com/repos/livecode/livecode/contents/{+path}","compare_url":"https://api.github.com/repos/livecode/livecode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/livecode/livecode/merges","archive_url":"https://api.github.com/repos/livecode/livecode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/livecode/livecode/downloads","issues_url":"https://api.github.com/repos/livecode/livecode/issues{/number}","pulls_url":"https://api.github.com/repos/livecode/livecode/pulls{/number}","milestones_url":"https://api.github.com/repos/livecode/livecode/milestones{/number}","notifications_url":"https://api.github.com/repos/livecode/livecode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/livecode/livecode/labels{/name}","releases_url":"https://api.github.com/repos/livecode/livecode/releases{/id}","deployments_url":"https://api.github.com/repos/livecode/livecode/deployments","created_at":"2013-04-10T00:15:57Z","updated_at":"2017-04-04T20:23:17Z","pushed_at":"2017-04-11T14:30:02Z","git_url":"git://github.com/livecode/livecode.git","ssh_url":"git@github.com:livecode/livecode.git","clone_url":"https://github.com/livecode/livecode.git","svn_url":"https://github.com/livecode/livecode","homepage":"https://livecode.com/","size":137632,"stargazers_count":167,"watchers_count":167,"language":"C++","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":119,"mirror_url":null,"open_issues_count":83,"forks":119,"open_issues":83,"watchers":167,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/livecode/livecode/pulls/5362"},"html":{"href":"https://github.com/livecode/livecode/pull/5362"},"issue":{"href":"https://api.github.com/repos/livecode/livecode/issues/5362"},"comments":{"href":"https://api.github.com/repos/livecode/livecode/issues/5362/comments"},"review_comments":{"href":"https://api.github.com/repos/livecode/livecode/pulls/5362/comments"},"review_comment":{"href":"https://api.github.com/repos/livecode/livecode/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/livecode/livecode/pulls/5362/commits"},"statuses":{"href":"https://api.github.com/repos/livecode/livecode/statuses/98ee2ac551493dedded23183e297d293c44ca994"}},"merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"peter-b","id":47528,"avatar_url":"https://avatars1.githubusercontent.com/u/47528?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-b","html_url":"https://github.com/peter-b","followers_url":"https://api.github.com/users/peter-b/followers","following_url":"https://api.github.com/users/peter-b/following{/other_user}","gists_url":"https://api.github.com/users/peter-b/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-b/subscriptions","organizations_url":"https://api.github.com/users/peter-b/orgs","repos_url":"https://api.github.com/users/peter-b/repos","events_url":"https://api.github.com/users/peter-b/events{/privacy}","received_events_url":"https://api.github.com/users/peter-b/received_events","type":"User","site_admin":false},"comments":3,"review_comments":0,"maintainer_can_modify":false,"commits":2,"additions":22,"deletions":1,"changed_files":1}}
{"actor":{"display_login":"peter-b"}}