{"action":"created","comment":{"url":"https://api.github.com/repos/heycam/webidl/pulls/comments/81444109","pull_request_review_id":2426495,"id":81444109,"diff_hunk":"@@ -7529,6 +7575,95 @@ iterable |iterable| and an iterator getter\n </div>\n \n \n+<h4 id=\"es-open-dictionary\">Open dictionaries — OpenDictionary&lt;[|K|,] |V|&gt;</h4>\n+\n+IDL {{OpenDictionary}}&lt;|K|, |V|&gt; values are represented by\n+ECMAScript <emu-val>Object</emu-val> values.\n+\n+<p id=\"es-to-open-dictionary\">\n+    An ECMAScript value |O| is [=converted to an IDL value|converted=] to an IDL <code>{{OpenDictionary}}<|K|, |V|></code> value as follows:\n+</p>\n+\n+<ol class=\"algorithm\">\n+    1.  Let |result| be a new empty instance of <code>{{OpenDictionary}}<|K|, |V|></code>.\n+    1.  If [=Type=](|O|) is <emu-val>Undefined</emu-val> or <emu-val>Null</emu-val>,\n+        return |result|.\n+    1.  If [=Type=](|O|) is not <emu-val>Object</emu-val>,\n+        <a lt=\"es throw\">throw a <emu-val>TypeError</emu-val></a>.\n+    1.  Let |keys| be [=?=] [=EnumerableOwnProperties=](|O|, \"key\").\n+    1.  Repeat, for each element |key| of |keys| in [=List=] order:\n+        1.  If [=!=] [=HasOwnProperty=](|O|, |key|) is <code>true</code>, then:\n+            1.  Let |typedKey| be |key| [=converted to an IDL value=] of type |K|.\n+            1.  Let |value| be [=?=] [=Get=](|O|, |key|).\n+            1.  Let |typedValue| be |value| [=converted to an IDL value=] of type |V|.\n+            1.  Assert: |typedKey| is not yet a key in |result|.\n+            1.  Append to |result| a mapping from |typedKey| to |typedValue|.\n+    1.  Return |result|.\n+</ol>\n+\n+<p id=\"open-dictionary-to-es\">\n+    An IDL <code>{{OpenDictionary}}<…></code> value |D| is [=converted to an\n+    ECMAScript value|converted=] to an ECMAScript value as follows:\n+</p>\n+\n+<ol class=\"algorithm\">\n+    1.  Let |result| be [=!=] [=ObjectCreate=]([=%ObjectPrototype%=]).\n+    1.  Repeat, for each [=OpenDictionary/mapping=] (|key|, |value|) in |D|:\n+        1.  Let |esKey| be |key| [=converted to an ECMAScript value=].\n+        1.  Let |esValue| be |value| [=converted to an ECMAScript value=].\n+        1.  Let |created| be [=!=] [=CreateDataProperty=](|result|, |esKey|, |esValue|).\n+        1.  Assert: |created| is <code>true</code>.\n+    1.  Return |result|.\n+</ol>\n+\n+<div class=\"example\" id=\"example-es-open-dictionary\">\n+    Passing the ECMAScript value <code>{b: 3, a: 4}</code> to a\n+    <code>{{OpenDictionary}}&lt;DOMString, double></code> argument\n+    would result in the IDL value <code>[ \"b\" ⇒ 3, \"a\" ⇒ 4 ]</code>.\n+\n+    Open dictionaries only consider [=own property|own=] [=enumerable=] properties, so given an IDL operation\n+    <code>OpenDictionary&lt;double> identity(OpenDictionary&lt;double> arg)</code> which\n+    returns its argument, the following code passes its assertions:\n+\n+    <pre highlight=\"js\">\n+        let proto = {a: 3, b: 4};\n+        let obj = {__proto__: proto, d: 5, c: 6}\n+        Object.defineProperty(obj, \"e\", {value: 7, enumerable: false});\n+        let result = identity(obj);\n+        console.assert(result.a === undefined);\n+        console.assert(result.b === undefined);\n+        console.assert(result.e === undefined);\n+        let entries = Object.entries(result);\n+        console.assert(entries[0][0] === \"d\");\n+        console.assert(entries[0][1] === 5);\n+        console.assert(entries[1][0] === \"c\");\n+        console.assert(entries[1][1] === 6);\n+    </pre>\n+\n+    Open dictionary keys and values can be constrained, although keys can only be\n+    constrained among the three string types.\n+    The following conversions have the described results:\n+    <table class=\"data\">\n+        <thead><th>Value</th><th>Passed to type</th><th>Result</th></thead>\n+        <tr>\n+            <td><code>{\"😞\": 1}</code></td>\n+            <td><code>{{OpenDictionary}}&lt;ByteString, double></code></td>\n+            <td><emu-val>TypeError</emu-val></td>\n+        </tr>\n+        <tr>\n+            <td><code>{\"\\uD83D\": 1}</code></td>\n+            <td><code>{{OpenDictionary}}&lt;USVString, double></code></td>\n+            <td>[ \"\\uFFFD\" ⇒ 1 ]</td>","path":"index.bs","position":163,"original_position":163,"commit_id":"399fc10238a7cd5402d45edf8807ec24060bb1e3","original_commit_id":"399fc10238a7cd5402d45edf8807ec24060bb1e3","user":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"body":"It seems you are inconsistent about notation for the mappings; here you use an arrow, whereas above you use \"Repeat, for each mapping (key, value) in D\". Both seem reasonable, but it would be good to pick one and maybe mention it in the section that introduces the concept of mappings.","created_at":"2016-10-01T05:08:31Z","updated_at":"2016-10-01T05:08:38Z","html_url":"https://github.com/heycam/webidl/pull/180#discussion_r81444109","pull_request_url":"https://api.github.com/repos/heycam/webidl/pulls/180","_links":{"self":{"href":"https://api.github.com/repos/heycam/webidl/pulls/comments/81444109"},"html":{"href":"https://github.com/heycam/webidl/pull/180#discussion_r81444109"},"pull_request":{"href":"https://api.github.com/repos/heycam/webidl/pulls/180"}}},"pull_request":{"url":"https://api.github.com/repos/heycam/webidl/pulls/180","id":87420956,"html_url":"https://github.com/heycam/webidl/pull/180","diff_url":"https://github.com/heycam/webidl/pull/180.diff","patch_url":"https://github.com/heycam/webidl/pull/180.patch","issue_url":"https://api.github.com/repos/heycam/webidl/issues/180","number":180,"state":"open","locked":false,"title":"Specify open dictionaries.","user":{"login":"jyasskin","id":83420,"avatar_url":"https://avatars.githubusercontent.com/u/83420?v=3","gravatar_id":"","url":"https://api.github.com/users/jyasskin","html_url":"https://github.com/jyasskin","followers_url":"https://api.github.com/users/jyasskin/followers","following_url":"https://api.github.com/users/jyasskin/following{/other_user}","gists_url":"https://api.github.com/users/jyasskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyasskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyasskin/subscriptions","organizations_url":"https://api.github.com/users/jyasskin/orgs","repos_url":"https://api.github.com/users/jyasskin/repos","events_url":"https://api.github.com/users/jyasskin/events{/privacy}","received_events_url":"https://api.github.com/users/jyasskin/received_events","type":"User","site_admin":false},"body":"Let me know what you think. Preview at https://rawgit.com/jyasskin/webidl/open-dictionaries/index.html.\r\n\r\nI tried to position `dictionary<K, V>` as a dictionary type, but we may need to move some things from https://rawgit.com/jyasskin/webidl/open-dictionaries/index.html#idl-dictionaries to https://rawgit.com/jyasskin/webidl/open-dictionaries/index.html#idl-dictionary to really make that work. \r\n\r\nI introduced a [\"mappings\"](https://rawgit.com/jyasskin/webidl/open-dictionaries/index.html#dictionary-mappings) term for the contents of an open dictionary, but I might be able to re-use \"dictionary members\".\r\n\r\nI used `<div algorithm>` blocks to get better `<var>` checking, but that also results in boxes around the algorithms, which you might or might not like.\r\n\r\n@bzbarsky @tobie @annevk","created_at":"2016-09-30T01:22:30Z","updated_at":"2016-10-01T05:08:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"433d9627dc52572d0d89af479f3338b7116a4e61","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/heycam/webidl/pulls/180/commits","review_comments_url":"https://api.github.com/repos/heycam/webidl/pulls/180/comments","review_comment_url":"https://api.github.com/repos/heycam/webidl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/heycam/webidl/issues/180/comments","statuses_url":"https://api.github.com/repos/heycam/webidl/statuses/399fc10238a7cd5402d45edf8807ec24060bb1e3","head":{"label":"jyasskin:open-dictionaries","ref":"open-dictionaries","sha":"399fc10238a7cd5402d45edf8807ec24060bb1e3","user":{"login":"jyasskin","id":83420,"avatar_url":"https://avatars.githubusercontent.com/u/83420?v=3","gravatar_id":"","url":"https://api.github.com/users/jyasskin","html_url":"https://github.com/jyasskin","followers_url":"https://api.github.com/users/jyasskin/followers","following_url":"https://api.github.com/users/jyasskin/following{/other_user}","gists_url":"https://api.github.com/users/jyasskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyasskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyasskin/subscriptions","organizations_url":"https://api.github.com/users/jyasskin/orgs","repos_url":"https://api.github.com/users/jyasskin/repos","events_url":"https://api.github.com/users/jyasskin/events{/privacy}","received_events_url":"https://api.github.com/users/jyasskin/received_events","type":"User","site_admin":false},"repo":{"id":38397734,"name":"webidl","full_name":"jyasskin/webidl","owner":{"login":"jyasskin","id":83420,"avatar_url":"https://avatars.githubusercontent.com/u/83420?v=3","gravatar_id":"","url":"https://api.github.com/users/jyasskin","html_url":"https://github.com/jyasskin","followers_url":"https://api.github.com/users/jyasskin/followers","following_url":"https://api.github.com/users/jyasskin/following{/other_user}","gists_url":"https://api.github.com/users/jyasskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyasskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyasskin/subscriptions","organizations_url":"https://api.github.com/users/jyasskin/orgs","repos_url":"https://api.github.com/users/jyasskin/repos","events_url":"https://api.github.com/users/jyasskin/events{/privacy}","received_events_url":"https://api.github.com/users/jyasskin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jyasskin/webidl","description":"","fork":true,"url":"https://api.github.com/repos/jyasskin/webidl","forks_url":"https://api.github.com/repos/jyasskin/webidl/forks","keys_url":"https://api.github.com/repos/jyasskin/webidl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jyasskin/webidl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jyasskin/webidl/teams","hooks_url":"https://api.github.com/repos/jyasskin/webidl/hooks","issue_events_url":"https://api.github.com/repos/jyasskin/webidl/issues/events{/number}","events_url":"https://api.github.com/repos/jyasskin/webidl/events","assignees_url":"https://api.github.com/repos/jyasskin/webidl/assignees{/user}","branches_url":"https://api.github.com/repos/jyasskin/webidl/branches{/branch}","tags_url":"https://api.github.com/repos/jyasskin/webidl/tags","blobs_url":"https://api.github.com/repos/jyasskin/webidl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jyasskin/webidl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jyasskin/webidl/git/refs{/sha}","trees_url":"https://api.github.com/repos/jyasskin/webidl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jyasskin/webidl/statuses/{sha}","languages_url":"https://api.github.com/repos/jyasskin/webidl/languages","stargazers_url":"https://api.github.com/repos/jyasskin/webidl/stargazers","contributors_url":"https://api.github.com/repos/jyasskin/webidl/contributors","subscribers_url":"https://api.github.com/repos/jyasskin/webidl/subscribers","subscription_url":"https://api.github.com/repos/jyasskin/webidl/subscription","commits_url":"https://api.github.com/repos/jyasskin/webidl/commits{/sha}","git_commits_url":"https://api.github.com/repos/jyasskin/webidl/git/commits{/sha}","comments_url":"https://api.github.com/repos/jyasskin/webidl/comments{/number}","issue_comment_url":"https://api.github.com/repos/jyasskin/webidl/issues/comments{/number}","contents_url":"https://api.github.com/repos/jyasskin/webidl/contents/{+path}","compare_url":"https://api.github.com/repos/jyasskin/webidl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jyasskin/webidl/merges","archive_url":"https://api.github.com/repos/jyasskin/webidl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jyasskin/webidl/downloads","issues_url":"https://api.github.com/repos/jyasskin/webidl/issues{/number}","pulls_url":"https://api.github.com/repos/jyasskin/webidl/pulls{/number}","milestones_url":"https://api.github.com/repos/jyasskin/webidl/milestones{/number}","notifications_url":"https://api.github.com/repos/jyasskin/webidl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jyasskin/webidl/labels{/name}","releases_url":"https://api.github.com/repos/jyasskin/webidl/releases{/id}","deployments_url":"https://api.github.com/repos/jyasskin/webidl/deployments","created_at":"2015-07-01T22:14:00Z","updated_at":"2016-09-28T21:27:53Z","pushed_at":"2016-10-01T00:18:00Z","git_url":"git://github.com/jyasskin/webidl.git","ssh_url":"git@github.com:jyasskin/webidl.git","clone_url":"https://github.com/jyasskin/webidl.git","svn_url":"https://github.com/jyasskin/webidl","homepage":null,"size":18372,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"gh-pages"}},"base":{"label":"heycam:gh-pages","ref":"gh-pages","sha":"a096dbc431668feedf907b0bd7fb6426a4270161","user":{"login":"heycam","id":1484434,"avatar_url":"https://avatars.githubusercontent.com/u/1484434?v=3","gravatar_id":"","url":"https://api.github.com/users/heycam","html_url":"https://github.com/heycam","followers_url":"https://api.github.com/users/heycam/followers","following_url":"https://api.github.com/users/heycam/following{/other_user}","gists_url":"https://api.github.com/users/heycam/gists{/gist_id}","starred_url":"https://api.github.com/users/heycam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heycam/subscriptions","organizations_url":"https://api.github.com/users/heycam/orgs","repos_url":"https://api.github.com/users/heycam/repos","events_url":"https://api.github.com/users/heycam/events{/privacy}","received_events_url":"https://api.github.com/users/heycam/received_events","type":"User","site_admin":false},"repo":{"id":14131914,"name":"webidl","full_name":"heycam/webidl","owner":{"login":"heycam","id":1484434,"avatar_url":"https://avatars.githubusercontent.com/u/1484434?v=3","gravatar_id":"","url":"https://api.github.com/users/heycam","html_url":"https://github.com/heycam","followers_url":"https://api.github.com/users/heycam/followers","following_url":"https://api.github.com/users/heycam/following{/other_user}","gists_url":"https://api.github.com/users/heycam/gists{/gist_id}","starred_url":"https://api.github.com/users/heycam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heycam/subscriptions","organizations_url":"https://api.github.com/users/heycam/orgs","repos_url":"https://api.github.com/users/heycam/repos","events_url":"https://api.github.com/users/heycam/events{/privacy}","received_events_url":"https://api.github.com/users/heycam/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/heycam/webidl","description":"","fork":false,"url":"https://api.github.com/repos/heycam/webidl","forks_url":"https://api.github.com/repos/heycam/webidl/forks","keys_url":"https://api.github.com/repos/heycam/webidl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/heycam/webidl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/heycam/webidl/teams","hooks_url":"https://api.github.com/repos/heycam/webidl/hooks","issue_events_url":"https://api.github.com/repos/heycam/webidl/issues/events{/number}","events_url":"https://api.github.com/repos/heycam/webidl/events","assignees_url":"https://api.github.com/repos/heycam/webidl/assignees{/user}","branches_url":"https://api.github.com/repos/heycam/webidl/branches{/branch}","tags_url":"https://api.github.com/repos/heycam/webidl/tags","blobs_url":"https://api.github.com/repos/heycam/webidl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/heycam/webidl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/heycam/webidl/git/refs{/sha}","trees_url":"https://api.github.com/repos/heycam/webidl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/heycam/webidl/statuses/{sha}","languages_url":"https://api.github.com/repos/heycam/webidl/languages","stargazers_url":"https://api.github.com/repos/heycam/webidl/stargazers","contributors_url":"https://api.github.com/repos/heycam/webidl/contributors","subscribers_url":"https://api.github.com/repos/heycam/webidl/subscribers","subscription_url":"https://api.github.com/repos/heycam/webidl/subscription","commits_url":"https://api.github.com/repos/heycam/webidl/commits{/sha}","git_commits_url":"https://api.github.com/repos/heycam/webidl/git/commits{/sha}","comments_url":"https://api.github.com/repos/heycam/webidl/comments{/number}","issue_comment_url":"https://api.github.com/repos/heycam/webidl/issues/comments{/number}","contents_url":"https://api.github.com/repos/heycam/webidl/contents/{+path}","compare_url":"https://api.github.com/repos/heycam/webidl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/heycam/webidl/merges","archive_url":"https://api.github.com/repos/heycam/webidl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/heycam/webidl/downloads","issues_url":"https://api.github.com/repos/heycam/webidl/issues{/number}","pulls_url":"https://api.github.com/repos/heycam/webidl/pulls{/number}","milestones_url":"https://api.github.com/repos/heycam/webidl/milestones{/number}","notifications_url":"https://api.github.com/repos/heycam/webidl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/heycam/webidl/labels{/name}","releases_url":"https://api.github.com/repos/heycam/webidl/releases{/id}","deployments_url":"https://api.github.com/repos/heycam/webidl/deployments","created_at":"2013-11-05T04:17:09Z","updated_at":"2016-09-30T07:43:31Z","pushed_at":"2016-10-01T00:18:00Z","git_url":"git://github.com/heycam/webidl.git","ssh_url":"git@github.com:heycam/webidl.git","clone_url":"https://github.com/heycam/webidl.git","svn_url":"https://github.com/heycam/webidl","homepage":null,"size":17973,"stargazers_count":28,"watchers_count":28,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":48,"forks":29,"open_issues":48,"watchers":28,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/heycam/webidl/pulls/180"},"html":{"href":"https://github.com/heycam/webidl/pull/180"},"issue":{"href":"https://api.github.com/repos/heycam/webidl/issues/180"},"comments":{"href":"https://api.github.com/repos/heycam/webidl/issues/180/comments"},"review_comments":{"href":"https://api.github.com/repos/heycam/webidl/pulls/180/comments"},"review_comment":{"href":"https://api.github.com/repos/heycam/webidl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/heycam/webidl/pulls/180/commits"},"statuses":{"href":"https://api.github.com/repos/heycam/webidl/statuses/399fc10238a7cd5402d45edf8807ec24060bb1e3"}}}}
{"actor":{"display_login":"domenic"}}