{"action":"created","comment":{"url":"https://api.github.com/repos/svaarala/duktape/pulls/comments/81270411","pull_request_review_id":2262232,"id":81270411,"diff_hunk":"@@ -0,0 +1,247 @@\n+/*\n+ *  Basic Symbol behavior.\n+ */\n+\n+print=console.log\n+\n+/*===\n+===*/\n+\n+function symbolCreationTest() {\n+    var s, s1, s2;\n+\n+    // Constructing as 'new' is a TypeError.\n+    try {\n+        s = new Symbol();\n+    } catch (e) {\n+        print(e.name);\n+    }\n+    try {\n+        s = new Symbol('123');\n+    } catch (e) {\n+        print(e.name);\n+    }\n+\n+    // Creating an anonymous symbol.\n+    s1 = Symbol();\n+    s2 = Symbol();\n+    print(s1);\n+    print(s1.toString());\n+    print(s2);\n+    print(s2.toString());\n+    print(s1 == s2, s1 === s2);  // never equal\n+\n+    // Creating a symbol with a description.\n+    s1 = Symbol('123');\n+    s2 = Symbol('123');\n+    print(s1);\n+    print(s1.toString());\n+    print(s2);\n+    print(s2.toString());\n+    print(s1 == s2, s1 === s2);  // never equal\n+\n+    // Symbol() argument is string coerced.\n+    s1 = Symbol(123);\n+    s2 = Symbol(true);\n+    print(s1);\n+    print(s2);\n+\n+    // ToString(Symbol('foo')) is a TypeError (E6 Section 7.1.12).\n+    try {\n+        s1 = Symbol(Symbol('foo'));\n+        print(s1);\n+    } catch (e) {\n+        print(e.name);\n+    }\n+\n+    // But explicit .toString() returns e.g. \"Symbol(foo)\" which works as an\n+    // argument for creating an odd symbol.\n+    try {\n+        s1 = Symbol(Symbol('foo').toString());\n+        print(s1);\n+    } catch (e) {\n+        print(e.name);\n+    }\n+\n+    // Missing argument and undefined are treated specially, other arguments\n+    // are string coerced (even when it makes little sense).\n+    s1 = Symbol();\n+    s2 = Symbol(void 0);\n+    print(s1);\n+    print(s2);\n+    s1 = Symbol(null);\n+    print(s1);\n+    s1 = Symbol(new ArrayBuffer(9));\n+    print(s1);\n+\n+    // Specification differentiates between 'undefined' [[Ðescription]] and\n+    // empty string description on creation, but 'undefined' description is\n+    // in practice treated like an empty string where descriptions are used.\n+    // FIXME: test?\n+\n+    //\n+}\n+\n+try {\n+    print('symbol creation');\n+    symbolCreationTest();\n+} catch (e) {\n+    print(e.stack || e);\n+}\n+\n+/*===\n+===*/\n+\n+function symbolCoercionTest() {\n+    var s1, s2, s3, o1, o2, o3;\n+    var t;\n+\n+    // Object coercion creates a wrapped Symbol which non-strict equals\n+    // the plain symbol.  Double Object coercion is idempotent (of course).\n+    s1 = Symbol('123');\n+    o1 = Object(s1);\n+    print(s1 == o1, s1 === o1);\n+    o2 = Object(o1);\n+    print(s1 == o2, s1 === o2);\n+    print(o1 === o1);\n+\n+    // ToString coercion is a TypeError.\n+    try {\n+        s1 = Symbol('123');\n+        t = String(s1);","path":"tests/ecmascript/test-bi-symbol-basic.js","position":111,"original_position":111,"commit_id":"311d315933f21e64e7d5fdae22417882cf08ca46","original_commit_id":"39472fcc86e6b734f58ca9efb5fae1d31014e54a","user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"body":"Ah, my bad: in ES6 the String() constructor call has a special case for Symbols so that it doesn't end up invoking the built-in ToString() operation: http://www.ecma-international.org/ecma-262/6.0/#sec-string-constructor-string-value.\r\n\r\nBut anything that causes `ToString()` to happen should TypeError. So V8 is probably right here, Symbol() uses ToString().","created_at":"2016-09-30T02:28:19Z","updated_at":"2016-09-30T02:28:19Z","html_url":"https://github.com/svaarala/duktape/pull/982#discussion_r81270411","pull_request_url":"https://api.github.com/repos/svaarala/duktape/pulls/982","_links":{"self":{"href":"https://api.github.com/repos/svaarala/duktape/pulls/comments/81270411"},"html":{"href":"https://github.com/svaarala/duktape/pull/982#discussion_r81270411"},"pull_request":{"href":"https://api.github.com/repos/svaarala/duktape/pulls/982"}}},"pull_request":{"url":"https://api.github.com/repos/svaarala/duktape/pulls/982","id":87421307,"html_url":"https://github.com/svaarala/duktape/pull/982","diff_url":"https://github.com/svaarala/duktape/pull/982.diff","patch_url":"https://github.com/svaarala/duktape/pull/982.patch","issue_url":"https://api.github.com/repos/svaarala/duktape/issues/982","number":982,"state":"open","locked":false,"title":"Draft for ES6 Symbol support","user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"body":"**Work in progress**\r\n\r\nThis is a prototype for an implementation approach where Symbols are `duk_hstring`s with a specific byte prefix which cannot occur for valid (extended) UTF-8 strings. The existing internal string concept is essentially taken a step further to support ES6 Symbols. There's no new internal type for Symbols as such, and the C API sees Symbols as just strings.\r\n\r\nThere are both pros and cons in this approach so depending on the outcome this might not be merged.","created_at":"2016-09-30T01:28:20Z","updated_at":"2016-09-30T02:28:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee7047343e63a968b840cdc5fdaf173641b1d980","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/svaarala/duktape/milestones/5","html_url":"https://github.com/svaarala/duktape/milestones/v2.0.0","labels_url":"https://api.github.com/repos/svaarala/duktape/milestones/5/labels","id":840957,"number":5,"title":"v2.0.0","description":"","creator":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"open_issues":64,"closed_issues":153,"state":"open","created_at":"2014-10-26T15:05:37Z","updated_at":"2016-09-30T01:28:20Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/svaarala/duktape/pulls/982/commits","review_comments_url":"https://api.github.com/repos/svaarala/duktape/pulls/982/comments","review_comment_url":"https://api.github.com/repos/svaarala/duktape/pulls/comments{/number}","comments_url":"https://api.github.com/repos/svaarala/duktape/issues/982/comments","statuses_url":"https://api.github.com/repos/svaarala/duktape/statuses/311d315933f21e64e7d5fdae22417882cf08ca46","head":{"label":"svaarala:es6-symbol-initial","ref":"es6-symbol-initial","sha":"311d315933f21e64e7d5fdae22417882cf08ca46","user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"repo":{"id":15852088,"name":"duktape","full_name":"svaarala/duktape","owner":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/svaarala/duktape","description":"Duktape - embeddable Javascript engine with a focus on portability and compact footprint","fork":false,"url":"https://api.github.com/repos/svaarala/duktape","forks_url":"https://api.github.com/repos/svaarala/duktape/forks","keys_url":"https://api.github.com/repos/svaarala/duktape/keys{/key_id}","collaborators_url":"https://api.github.com/repos/svaarala/duktape/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/svaarala/duktape/teams","hooks_url":"https://api.github.com/repos/svaarala/duktape/hooks","issue_events_url":"https://api.github.com/repos/svaarala/duktape/issues/events{/number}","events_url":"https://api.github.com/repos/svaarala/duktape/events","assignees_url":"https://api.github.com/repos/svaarala/duktape/assignees{/user}","branches_url":"https://api.github.com/repos/svaarala/duktape/branches{/branch}","tags_url":"https://api.github.com/repos/svaarala/duktape/tags","blobs_url":"https://api.github.com/repos/svaarala/duktape/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/svaarala/duktape/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/svaarala/duktape/git/refs{/sha}","trees_url":"https://api.github.com/repos/svaarala/duktape/git/trees{/sha}","statuses_url":"https://api.github.com/repos/svaarala/duktape/statuses/{sha}","languages_url":"https://api.github.com/repos/svaarala/duktape/languages","stargazers_url":"https://api.github.com/repos/svaarala/duktape/stargazers","contributors_url":"https://api.github.com/repos/svaarala/duktape/contributors","subscribers_url":"https://api.github.com/repos/svaarala/duktape/subscribers","subscription_url":"https://api.github.com/repos/svaarala/duktape/subscription","commits_url":"https://api.github.com/repos/svaarala/duktape/commits{/sha}","git_commits_url":"https://api.github.com/repos/svaarala/duktape/git/commits{/sha}","comments_url":"https://api.github.com/repos/svaarala/duktape/comments{/number}","issue_comment_url":"https://api.github.com/repos/svaarala/duktape/issues/comments{/number}","contents_url":"https://api.github.com/repos/svaarala/duktape/contents/{+path}","compare_url":"https://api.github.com/repos/svaarala/duktape/compare/{base}...{head}","merges_url":"https://api.github.com/repos/svaarala/duktape/merges","archive_url":"https://api.github.com/repos/svaarala/duktape/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/svaarala/duktape/downloads","issues_url":"https://api.github.com/repos/svaarala/duktape/issues{/number}","pulls_url":"https://api.github.com/repos/svaarala/duktape/pulls{/number}","milestones_url":"https://api.github.com/repos/svaarala/duktape/milestones{/number}","notifications_url":"https://api.github.com/repos/svaarala/duktape/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/svaarala/duktape/labels{/name}","releases_url":"https://api.github.com/repos/svaarala/duktape/releases{/id}","deployments_url":"https://api.github.com/repos/svaarala/duktape/deployments","created_at":"2014-01-12T22:16:14Z","updated_at":"2016-09-28T11:03:39Z","pushed_at":"2016-09-30T01:28:20Z","git_url":"git://github.com/svaarala/duktape.git","ssh_url":"git@github.com:svaarala/duktape.git","clone_url":"https://github.com/svaarala/duktape.git","svn_url":"https://github.com/svaarala/duktape","homepage":null,"size":77254,"stargazers_count":2385,"watchers_count":2385,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":217,"mirror_url":null,"open_issues_count":237,"forks":217,"open_issues":237,"watchers":2385,"default_branch":"master"}},"base":{"label":"svaarala:master","ref":"master","sha":"d1d4b2879ecef87631cb651169ed834d1a77c8d0","user":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"repo":{"id":15852088,"name":"duktape","full_name":"svaarala/duktape","owner":{"login":"svaarala","id":6377415,"avatar_url":"https://avatars.githubusercontent.com/u/6377415?v=3","gravatar_id":"","url":"https://api.github.com/users/svaarala","html_url":"https://github.com/svaarala","followers_url":"https://api.github.com/users/svaarala/followers","following_url":"https://api.github.com/users/svaarala/following{/other_user}","gists_url":"https://api.github.com/users/svaarala/gists{/gist_id}","starred_url":"https://api.github.com/users/svaarala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svaarala/subscriptions","organizations_url":"https://api.github.com/users/svaarala/orgs","repos_url":"https://api.github.com/users/svaarala/repos","events_url":"https://api.github.com/users/svaarala/events{/privacy}","received_events_url":"https://api.github.com/users/svaarala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/svaarala/duktape","description":"Duktape - embeddable Javascript engine with a focus on portability and compact footprint","fork":false,"url":"https://api.github.com/repos/svaarala/duktape","forks_url":"https://api.github.com/repos/svaarala/duktape/forks","keys_url":"https://api.github.com/repos/svaarala/duktape/keys{/key_id}","collaborators_url":"https://api.github.com/repos/svaarala/duktape/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/svaarala/duktape/teams","hooks_url":"https://api.github.com/repos/svaarala/duktape/hooks","issue_events_url":"https://api.github.com/repos/svaarala/duktape/issues/events{/number}","events_url":"https://api.github.com/repos/svaarala/duktape/events","assignees_url":"https://api.github.com/repos/svaarala/duktape/assignees{/user}","branches_url":"https://api.github.com/repos/svaarala/duktape/branches{/branch}","tags_url":"https://api.github.com/repos/svaarala/duktape/tags","blobs_url":"https://api.github.com/repos/svaarala/duktape/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/svaarala/duktape/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/svaarala/duktape/git/refs{/sha}","trees_url":"https://api.github.com/repos/svaarala/duktape/git/trees{/sha}","statuses_url":"https://api.github.com/repos/svaarala/duktape/statuses/{sha}","languages_url":"https://api.github.com/repos/svaarala/duktape/languages","stargazers_url":"https://api.github.com/repos/svaarala/duktape/stargazers","contributors_url":"https://api.github.com/repos/svaarala/duktape/contributors","subscribers_url":"https://api.github.com/repos/svaarala/duktape/subscribers","subscription_url":"https://api.github.com/repos/svaarala/duktape/subscription","commits_url":"https://api.github.com/repos/svaarala/duktape/commits{/sha}","git_commits_url":"https://api.github.com/repos/svaarala/duktape/git/commits{/sha}","comments_url":"https://api.github.com/repos/svaarala/duktape/comments{/number}","issue_comment_url":"https://api.github.com/repos/svaarala/duktape/issues/comments{/number}","contents_url":"https://api.github.com/repos/svaarala/duktape/contents/{+path}","compare_url":"https://api.github.com/repos/svaarala/duktape/compare/{base}...{head}","merges_url":"https://api.github.com/repos/svaarala/duktape/merges","archive_url":"https://api.github.com/repos/svaarala/duktape/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/svaarala/duktape/downloads","issues_url":"https://api.github.com/repos/svaarala/duktape/issues{/number}","pulls_url":"https://api.github.com/repos/svaarala/duktape/pulls{/number}","milestones_url":"https://api.github.com/repos/svaarala/duktape/milestones{/number}","notifications_url":"https://api.github.com/repos/svaarala/duktape/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/svaarala/duktape/labels{/name}","releases_url":"https://api.github.com/repos/svaarala/duktape/releases{/id}","deployments_url":"https://api.github.com/repos/svaarala/duktape/deployments","created_at":"2014-01-12T22:16:14Z","updated_at":"2016-09-28T11:03:39Z","pushed_at":"2016-09-30T01:28:20Z","git_url":"git://github.com/svaarala/duktape.git","ssh_url":"git@github.com:svaarala/duktape.git","clone_url":"https://github.com/svaarala/duktape.git","svn_url":"https://github.com/svaarala/duktape","homepage":null,"size":77254,"stargazers_count":2385,"watchers_count":2385,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":217,"mirror_url":null,"open_issues_count":237,"forks":217,"open_issues":237,"watchers":2385,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/svaarala/duktape/pulls/982"},"html":{"href":"https://github.com/svaarala/duktape/pull/982"},"issue":{"href":"https://api.github.com/repos/svaarala/duktape/issues/982"},"comments":{"href":"https://api.github.com/repos/svaarala/duktape/issues/982/comments"},"review_comments":{"href":"https://api.github.com/repos/svaarala/duktape/pulls/982/comments"},"review_comment":{"href":"https://api.github.com/repos/svaarala/duktape/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/svaarala/duktape/pulls/982/commits"},"statuses":{"href":"https://api.github.com/repos/svaarala/duktape/statuses/311d315933f21e64e7d5fdae22417882cf08ca46"}}}}
{"actor":{"display_login":"svaarala"}}