{"action":"created","comment":{"url":"https://api.github.com/repos/dlang/DIPs/pulls/comments/79339916","id":79339916,"diff_hunk":"@@ -0,0 +1,90 @@\n+# TryElseExpression\n+\n+| Field           | Value                                                           |\n+|-----------------|-----------------------------------------------------------------|\n+| DIP:            | 1002                                                            |\n+| Author:         | [Sophie Kirschner](https://github.com/pineapplemachine)         |\n+| Implementation: | n/a                                                             |\n+| Status:         | Draft                                                           |\n+\n+## Abstract\n+\n+In Python, the try/catch/finally syntax is augmented with an additional clause,\n+termed else. It is a fantastically useful addition to the conventional syntax.\n+It works like this:\n+\n+``` python\n+    try:\n+        do_something()\n+    except Exception as e:\n+        pass # Runs when an error inheriting from Exception was raised\n+    else:\n+        pass # Runs when no error was raised\n+    finally:\n+        pass # Runs unconditionally, evaluates last\n+```\n+\n+### Links\n+\n+* [Exception handling in Python](https://docs.python.org/3/tutorial/errors.html#handling-exceptions)\n+\n+## Description\n+\n+The _TryStatement_ would gain an additional piece, _TryElseStatement_, which\n+should be present after all _Catches_ and before a _FinallyStatement_, if any.\n+\n+The code in a _TryElseStatement_ would occur after the try's _ScopeStatement_,\n+would occur only if no exception was thrown, and would occur before the\n+_FinallyStatement_, if any is present. If any error occurs inside a\n+_TryElseStatement_, its corresponding _FinallyStatement_ is still evaluated.\n+\n+### Rationale\n+\n+Having such a facility built in to D's exception handling will allow the writing\n+of cleaner, less user-error-prone code.\n+\n+### Breaking changes / deprecation process\n+\n+This addition should not break any existing code.\n+\n+### Examples\n+\n+``` D\n+try{\n+    do_a_thing();\n+}catch(Exception exception){\n+    handle_error();\n+}else{\n+    depends_on_success_of_thing();\n+}finally{\n+    do_this_always();\n+}\n+```\n+\n+This is equivalent to:\n+\n+``` D\n+bool success = false;\n+try{\n+    do_a_thing();\n+    success = true;\n+}catch(Exception exception){\n+    handle_error();\n+}finally{\n+    try{\n+        if(success){\n+            depends_on_success_of_thing();\n+        }\n+    }finally{\n+        do_this_always();\n+    }\n+}\n+```","path":"DIPs/DIP1002.md","position":82,"original_position":82,"commit_id":"049b5c38c60a9ade296de321be69950ecf8ccd8a","original_commit_id":"049b5c38c60a9ade296de321be69950ecf8ccd8a","user":{"login":"Dicebot","id":1132234,"avatar_url":"https://avatars.githubusercontent.com/u/1132234?v=3","gravatar_id":"","url":"https://api.github.com/users/Dicebot","html_url":"https://github.com/Dicebot","followers_url":"https://api.github.com/users/Dicebot/followers","following_url":"https://api.github.com/users/Dicebot/following{/other_user}","gists_url":"https://api.github.com/users/Dicebot/gists{/gist_id}","starred_url":"https://api.github.com/users/Dicebot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dicebot/subscriptions","organizations_url":"https://api.github.com/users/Dicebot/orgs","repos_url":"https://api.github.com/users/Dicebot/repos","events_url":"https://api.github.com/users/Dicebot/events{/privacy}","received_events_url":"https://api.github.com/users/Dicebot/received_events","type":"User","site_admin":false},"body":"To stress this a bit more, I feel like right now the DIP doesn't do a very good job at convincing the reader that proposed the change will result in worthy improvement. This is not a blocker for merging on its own but can notably decrease the chance of merged DIP to get eventually approved.","created_at":"2016-09-19T07:50:54Z","updated_at":"2016-09-19T07:50:54Z","html_url":"https://github.com/dlang/DIPs/pull/43#discussion_r79339916","pull_request_url":"https://api.github.com/repos/dlang/DIPs/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/dlang/DIPs/pulls/comments/79339916"},"html":{"href":"https://github.com/dlang/DIPs/pull/43#discussion_r79339916"},"pull_request":{"href":"https://api.github.com/repos/dlang/DIPs/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/dlang/DIPs/pulls/43","id":83990705,"html_url":"https://github.com/dlang/DIPs/pull/43","diff_url":"https://github.com/dlang/DIPs/pull/43.diff","patch_url":"https://github.com/dlang/DIPs/pull/43.patch","issue_url":"https://api.github.com/repos/dlang/DIPs/issues/43","number":43,"state":"open","locked":false,"title":"TryElseExpression","user":{"login":"pineapplemachine","id":7266412,"avatar_url":"https://avatars.githubusercontent.com/u/7266412?v=3","gravatar_id":"","url":"https://api.github.com/users/pineapplemachine","html_url":"https://github.com/pineapplemachine","followers_url":"https://api.github.com/users/pineapplemachine/followers","following_url":"https://api.github.com/users/pineapplemachine/following{/other_user}","gists_url":"https://api.github.com/users/pineapplemachine/gists{/gist_id}","starred_url":"https://api.github.com/users/pineapplemachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pineapplemachine/subscriptions","organizations_url":"https://api.github.com/users/pineapplemachine/orgs","repos_url":"https://api.github.com/users/pineapplemachine/repos","events_url":"https://api.github.com/users/pineapplemachine/events{/privacy}","received_events_url":"https://api.github.com/users/pineapplemachine/received_events","type":"User","site_admin":false},"body":"A borrowing of Python's `else` in exception handling","created_at":"2016-09-05T11:49:25Z","updated_at":"2016-09-19T07:50:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d7dba8ccbcf40a6d003e18e1bc1a1766d191c8a2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dlang/DIPs/pulls/43/commits","review_comments_url":"https://api.github.com/repos/dlang/DIPs/pulls/43/comments","review_comment_url":"https://api.github.com/repos/dlang/DIPs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dlang/DIPs/issues/43/comments","statuses_url":"https://api.github.com/repos/dlang/DIPs/statuses/049b5c38c60a9ade296de321be69950ecf8ccd8a","head":{"label":"pineapplemachine:master","ref":"master","sha":"049b5c38c60a9ade296de321be69950ecf8ccd8a","user":{"login":"pineapplemachine","id":7266412,"avatar_url":"https://avatars.githubusercontent.com/u/7266412?v=3","gravatar_id":"","url":"https://api.github.com/users/pineapplemachine","html_url":"https://github.com/pineapplemachine","followers_url":"https://api.github.com/users/pineapplemachine/followers","following_url":"https://api.github.com/users/pineapplemachine/following{/other_user}","gists_url":"https://api.github.com/users/pineapplemachine/gists{/gist_id}","starred_url":"https://api.github.com/users/pineapplemachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pineapplemachine/subscriptions","organizations_url":"https://api.github.com/users/pineapplemachine/orgs","repos_url":"https://api.github.com/users/pineapplemachine/repos","events_url":"https://api.github.com/users/pineapplemachine/events{/privacy}","received_events_url":"https://api.github.com/users/pineapplemachine/received_events","type":"User","site_admin":false},"repo":{"id":67416371,"name":"DIPs","full_name":"pineapplemachine/DIPs","owner":{"login":"pineapplemachine","id":7266412,"avatar_url":"https://avatars.githubusercontent.com/u/7266412?v=3","gravatar_id":"","url":"https://api.github.com/users/pineapplemachine","html_url":"https://github.com/pineapplemachine","followers_url":"https://api.github.com/users/pineapplemachine/followers","following_url":"https://api.github.com/users/pineapplemachine/following{/other_user}","gists_url":"https://api.github.com/users/pineapplemachine/gists{/gist_id}","starred_url":"https://api.github.com/users/pineapplemachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pineapplemachine/subscriptions","organizations_url":"https://api.github.com/users/pineapplemachine/orgs","repos_url":"https://api.github.com/users/pineapplemachine/repos","events_url":"https://api.github.com/users/pineapplemachine/events{/privacy}","received_events_url":"https://api.github.com/users/pineapplemachine/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pineapplemachine/DIPs","description":"D Improvement Proposals","fork":true,"url":"https://api.github.com/repos/pineapplemachine/DIPs","forks_url":"https://api.github.com/repos/pineapplemachine/DIPs/forks","keys_url":"https://api.github.com/repos/pineapplemachine/DIPs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pineapplemachine/DIPs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pineapplemachine/DIPs/teams","hooks_url":"https://api.github.com/repos/pineapplemachine/DIPs/hooks","issue_events_url":"https://api.github.com/repos/pineapplemachine/DIPs/issues/events{/number}","events_url":"https://api.github.com/repos/pineapplemachine/DIPs/events","assignees_url":"https://api.github.com/repos/pineapplemachine/DIPs/assignees{/user}","branches_url":"https://api.github.com/repos/pineapplemachine/DIPs/branches{/branch}","tags_url":"https://api.github.com/repos/pineapplemachine/DIPs/tags","blobs_url":"https://api.github.com/repos/pineapplemachine/DIPs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pineapplemachine/DIPs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pineapplemachine/DIPs/git/refs{/sha}","trees_url":"https://api.github.com/repos/pineapplemachine/DIPs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pineapplemachine/DIPs/statuses/{sha}","languages_url":"https://api.github.com/repos/pineapplemachine/DIPs/languages","stargazers_url":"https://api.github.com/repos/pineapplemachine/DIPs/stargazers","contributors_url":"https://api.github.com/repos/pineapplemachine/DIPs/contributors","subscribers_url":"https://api.github.com/repos/pineapplemachine/DIPs/subscribers","subscription_url":"https://api.github.com/repos/pineapplemachine/DIPs/subscription","commits_url":"https://api.github.com/repos/pineapplemachine/DIPs/commits{/sha}","git_commits_url":"https://api.github.com/repos/pineapplemachine/DIPs/git/commits{/sha}","comments_url":"https://api.github.com/repos/pineapplemachine/DIPs/comments{/number}","issue_comment_url":"https://api.github.com/repos/pineapplemachine/DIPs/issues/comments{/number}","contents_url":"https://api.github.com/repos/pineapplemachine/DIPs/contents/{+path}","compare_url":"https://api.github.com/repos/pineapplemachine/DIPs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pineapplemachine/DIPs/merges","archive_url":"https://api.github.com/repos/pineapplemachine/DIPs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pineapplemachine/DIPs/downloads","issues_url":"https://api.github.com/repos/pineapplemachine/DIPs/issues{/number}","pulls_url":"https://api.github.com/repos/pineapplemachine/DIPs/pulls{/number}","milestones_url":"https://api.github.com/repos/pineapplemachine/DIPs/milestones{/number}","notifications_url":"https://api.github.com/repos/pineapplemachine/DIPs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pineapplemachine/DIPs/labels{/name}","releases_url":"https://api.github.com/repos/pineapplemachine/DIPs/releases{/id}","deployments_url":"https://api.github.com/repos/pineapplemachine/DIPs/deployments","created_at":"2016-09-05T11:47:56Z","updated_at":"2016-08-11T02:15:58Z","pushed_at":"2016-09-05T11:51:26Z","git_url":"git://github.com/pineapplemachine/DIPs.git","ssh_url":"git@github.com:pineapplemachine/DIPs.git","clone_url":"https://github.com/pineapplemachine/DIPs.git","svn_url":"https://github.com/pineapplemachine/DIPs","homepage":"","size":76,"stargazers_count":0,"watchers_count":0,"language":null,"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":"dlang:master","ref":"master","sha":"6ae49b3e335fa26e726e7dcd83144b07e48ed258","user":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"repo":{"id":60406222,"name":"DIPs","full_name":"dlang/DIPs","owner":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dlang/DIPs","description":"D Improvement Proposals","fork":false,"url":"https://api.github.com/repos/dlang/DIPs","forks_url":"https://api.github.com/repos/dlang/DIPs/forks","keys_url":"https://api.github.com/repos/dlang/DIPs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dlang/DIPs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dlang/DIPs/teams","hooks_url":"https://api.github.com/repos/dlang/DIPs/hooks","issue_events_url":"https://api.github.com/repos/dlang/DIPs/issues/events{/number}","events_url":"https://api.github.com/repos/dlang/DIPs/events","assignees_url":"https://api.github.com/repos/dlang/DIPs/assignees{/user}","branches_url":"https://api.github.com/repos/dlang/DIPs/branches{/branch}","tags_url":"https://api.github.com/repos/dlang/DIPs/tags","blobs_url":"https://api.github.com/repos/dlang/DIPs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dlang/DIPs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dlang/DIPs/git/refs{/sha}","trees_url":"https://api.github.com/repos/dlang/DIPs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dlang/DIPs/statuses/{sha}","languages_url":"https://api.github.com/repos/dlang/DIPs/languages","stargazers_url":"https://api.github.com/repos/dlang/DIPs/stargazers","contributors_url":"https://api.github.com/repos/dlang/DIPs/contributors","subscribers_url":"https://api.github.com/repos/dlang/DIPs/subscribers","subscription_url":"https://api.github.com/repos/dlang/DIPs/subscription","commits_url":"https://api.github.com/repos/dlang/DIPs/commits{/sha}","git_commits_url":"https://api.github.com/repos/dlang/DIPs/git/commits{/sha}","comments_url":"https://api.github.com/repos/dlang/DIPs/comments{/number}","issue_comment_url":"https://api.github.com/repos/dlang/DIPs/issues/comments{/number}","contents_url":"https://api.github.com/repos/dlang/DIPs/contents/{+path}","compare_url":"https://api.github.com/repos/dlang/DIPs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dlang/DIPs/merges","archive_url":"https://api.github.com/repos/dlang/DIPs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dlang/DIPs/downloads","issues_url":"https://api.github.com/repos/dlang/DIPs/issues{/number}","pulls_url":"https://api.github.com/repos/dlang/DIPs/pulls{/number}","milestones_url":"https://api.github.com/repos/dlang/DIPs/milestones{/number}","notifications_url":"https://api.github.com/repos/dlang/DIPs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dlang/DIPs/labels{/name}","releases_url":"https://api.github.com/repos/dlang/DIPs/releases{/id}","deployments_url":"https://api.github.com/repos/dlang/DIPs/deployments","created_at":"2016-06-04T11:01:23Z","updated_at":"2016-08-11T02:15:58Z","pushed_at":"2016-09-18T04:05:36Z","git_url":"git://github.com/dlang/DIPs.git","ssh_url":"git@github.com:dlang/DIPs.git","clone_url":"https://github.com/dlang/DIPs.git","svn_url":"https://github.com/dlang/DIPs","homepage":"","size":132,"stargazers_count":24,"watchers_count":24,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":7,"forks":20,"open_issues":7,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dlang/DIPs/pulls/43"},"html":{"href":"https://github.com/dlang/DIPs/pull/43"},"issue":{"href":"https://api.github.com/repos/dlang/DIPs/issues/43"},"comments":{"href":"https://api.github.com/repos/dlang/DIPs/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/dlang/DIPs/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/dlang/DIPs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dlang/DIPs/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/dlang/DIPs/statuses/049b5c38c60a9ade296de321be69950ecf8ccd8a"}}}}
{"actor":{"display_login":"Dicebot"}}