{"action":"created","comment":{"url":"https://api.github.com/repos/opencypher/openCypher/pulls/comments/70995669","id":70995669,"diff_hunk":"@@ -0,0 +1,79 @@\n+= CIP2016-07-07 - Type conversion functions\n+:numbered:\n+:toc:\n+:toc-placement: macro\n+:source-highlighter: codemirror\n+\n+*Author:* Mats Rydberg <mats@neotechnology.com>\n+\n+[abstract]\n+.Abstract\n+--\n+Cypher contains three type conversion functions `toString()`, `toInt()`, and `toFloat()`.\n+This CIP suggests introducing a more comprehensive rule for specifying the existence of these functions, following a simple `toX()` pattern, where `X` is the name of the type.\n+Further, this CIP suggests expanding this rule to encompass all scalar types.\n+--\n+\n+toc::[]\n+\n+\n+== Motivation\n+\n+The `toInt()` function indicates conversion to something called `Int`, which does not exist in Cypher.\n+Presumably every programmer will be aware that `int` is a common short form for `integer`, but this relies on an inherited, implicit piece of knowledge.\n+Following Cypher's guiding principles, explicit is better than implicit, and this CIP argues that `toInteger()` is a more explicit and better name.\n+\n+Furthermore, there is an opportunity to create a very simple and consistent rule that all scalar types should come with a type conversion function on the pattern `toX()` where `X` is the name of the type.\n+This has the consequence of adding a `toBoolean()` function to the language, creating a full set of conversion functions.\n+\n+== Proposal\n+\n+In concrete terms, this CIP suggests two things:\n+\n+- The function `toInt()` should be renamed to `toInteger()`.\n+- The function `toBoolean()` should be added to the language.\n+\n+=== Syntax\n+\n+Apart from adding a new function and changing the name of a function, no syntax changes are suggested.\n+\n+=== Semantics\n+\n+==== `toInteger()`\n+\n+The renamed `toInteger()` function would behave exactly the way `toInt()` behaves.\n+\n+==== `toBoolean()`\n+\n+The new `toBoolean()` function would only accept the two strings `'true'` and `'false'` as valid inputs, and would return `null` on any other input, similarly to how `toFloat()` and `toInt()` behave at the time of writing.\n+\n+=== Examples\n+\n+.Convert a string to an integer.\n+[source, cypher]\n+----\n+RETURN toInteger('1')\n+----\n+\n+.Convert a float to an integer.\n+[source, cypher]\n+----\n+RETURN toInteger(1.5)\n+----\n+\n+.Convert strings to booleans.\n+[source, cypher]\n+----\n+UNWIND ['true', 'false', 'foo'] AS s\n+RETURN toBoolean(s) // yields two booleans and one null\n+----\n+\n+=== Interaction with existing features\n+\n+With the addition of `toBoolean()`, it is now possible to do a round-trip conversion of booleans to strings (using `toString()`) and back again.\n+\n+== Benefits to this proposal","path":"cip/CIP2016-07-07-Type-conversion-functions.adoc","position":75,"original_position":75,"commit_id":"c2a8bd4c6677cd7935bf712f0986fdf637d5a197","original_commit_id":"98fe0cca11348a9a6c23e73daf7dbf3709d37dfa","user":{"login":"Mats-SX","id":2419675,"avatar_url":"https://avatars.githubusercontent.com/u/2419675?v=3","gravatar_id":"","url":"https://api.github.com/users/Mats-SX","html_url":"https://github.com/Mats-SX","followers_url":"https://api.github.com/users/Mats-SX/followers","following_url":"https://api.github.com/users/Mats-SX/following{/other_user}","gists_url":"https://api.github.com/users/Mats-SX/gists{/gist_id}","starred_url":"https://api.github.com/users/Mats-SX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mats-SX/subscriptions","organizations_url":"https://api.github.com/users/Mats-SX/orgs","repos_url":"https://api.github.com/users/Mats-SX/repos","events_url":"https://api.github.com/users/Mats-SX/events{/privacy}","received_events_url":"https://api.github.com/users/Mats-SX/received_events","type":"User","site_admin":false},"body":"Listified!","created_at":"2016-07-15T15:51:08Z","updated_at":"2016-07-15T15:51:08Z","html_url":"https://github.com/opencypher/openCypher/pull/111#discussion_r70995669","pull_request_url":"https://api.github.com/repos/opencypher/openCypher/pulls/111","_links":{"self":{"href":"https://api.github.com/repos/opencypher/openCypher/pulls/comments/70995669"},"html":{"href":"https://github.com/opencypher/openCypher/pull/111#discussion_r70995669"},"pull_request":{"href":"https://api.github.com/repos/opencypher/openCypher/pulls/111"}}},"pull_request":{"url":"https://api.github.com/repos/opencypher/openCypher/pulls/111","id":76605590,"html_url":"https://github.com/opencypher/openCypher/pull/111","diff_url":"https://github.com/opencypher/openCypher/pull/111.diff","patch_url":"https://github.com/opencypher/openCypher/pull/111.patch","issue_url":"https://api.github.com/repos/opencypher/openCypher/issues/111","number":111,"state":"open","locked":false,"title":"Add type conversion functions CIP","user":{"login":"Mats-SX","id":2419675,"avatar_url":"https://avatars.githubusercontent.com/u/2419675?v=3","gravatar_id":"","url":"https://api.github.com/users/Mats-SX","html_url":"https://github.com/Mats-SX","followers_url":"https://api.github.com/users/Mats-SX/followers","following_url":"https://api.github.com/users/Mats-SX/following{/other_user}","gists_url":"https://api.github.com/users/Mats-SX/gists{/gist_id}","starred_url":"https://api.github.com/users/Mats-SX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mats-SX/subscriptions","organizations_url":"https://api.github.com/users/Mats-SX/orgs","repos_url":"https://api.github.com/users/Mats-SX/repos","events_url":"https://api.github.com/users/Mats-SX/events{/privacy}","received_events_url":"https://api.github.com/users/Mats-SX/received_events","type":"User","site_admin":false},"body":"Suggests renaming `toInt()` to `toInteger()`, and addition of `toBoolean()`.","created_at":"2016-07-07T14:32:56Z","updated_at":"2016-07-15T15:51:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee5f2ab70cca698b3f34c1c57f01eb06ad83bdaf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/opencypher/openCypher/pulls/111/commits","review_comments_url":"https://api.github.com/repos/opencypher/openCypher/pulls/111/comments","review_comment_url":"https://api.github.com/repos/opencypher/openCypher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencypher/openCypher/issues/111/comments","statuses_url":"https://api.github.com/repos/opencypher/openCypher/statuses/c2a8bd4c6677cd7935bf712f0986fdf637d5a197","head":{"label":"Mats-SX:type-conv-functions","ref":"type-conv-functions","sha":"c2a8bd4c6677cd7935bf712f0986fdf637d5a197","user":{"login":"Mats-SX","id":2419675,"avatar_url":"https://avatars.githubusercontent.com/u/2419675?v=3","gravatar_id":"","url":"https://api.github.com/users/Mats-SX","html_url":"https://github.com/Mats-SX","followers_url":"https://api.github.com/users/Mats-SX/followers","following_url":"https://api.github.com/users/Mats-SX/following{/other_user}","gists_url":"https://api.github.com/users/Mats-SX/gists{/gist_id}","starred_url":"https://api.github.com/users/Mats-SX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mats-SX/subscriptions","organizations_url":"https://api.github.com/users/Mats-SX/orgs","repos_url":"https://api.github.com/users/Mats-SX/repos","events_url":"https://api.github.com/users/Mats-SX/events{/privacy}","received_events_url":"https://api.github.com/users/Mats-SX/received_events","type":"User","site_admin":false},"repo":{"id":45028229,"name":"openCypher","full_name":"Mats-SX/openCypher","owner":{"login":"Mats-SX","id":2419675,"avatar_url":"https://avatars.githubusercontent.com/u/2419675?v=3","gravatar_id":"","url":"https://api.github.com/users/Mats-SX","html_url":"https://github.com/Mats-SX","followers_url":"https://api.github.com/users/Mats-SX/followers","following_url":"https://api.github.com/users/Mats-SX/following{/other_user}","gists_url":"https://api.github.com/users/Mats-SX/gists{/gist_id}","starred_url":"https://api.github.com/users/Mats-SX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mats-SX/subscriptions","organizations_url":"https://api.github.com/users/Mats-SX/orgs","repos_url":"https://api.github.com/users/Mats-SX/repos","events_url":"https://api.github.com/users/Mats-SX/events{/privacy}","received_events_url":"https://api.github.com/users/Mats-SX/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mats-SX/openCypher","description":"Specification of the Cypher query language","fork":true,"url":"https://api.github.com/repos/Mats-SX/openCypher","forks_url":"https://api.github.com/repos/Mats-SX/openCypher/forks","keys_url":"https://api.github.com/repos/Mats-SX/openCypher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mats-SX/openCypher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mats-SX/openCypher/teams","hooks_url":"https://api.github.com/repos/Mats-SX/openCypher/hooks","issue_events_url":"https://api.github.com/repos/Mats-SX/openCypher/issues/events{/number}","events_url":"https://api.github.com/repos/Mats-SX/openCypher/events","assignees_url":"https://api.github.com/repos/Mats-SX/openCypher/assignees{/user}","branches_url":"https://api.github.com/repos/Mats-SX/openCypher/branches{/branch}","tags_url":"https://api.github.com/repos/Mats-SX/openCypher/tags","blobs_url":"https://api.github.com/repos/Mats-SX/openCypher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mats-SX/openCypher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mats-SX/openCypher/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mats-SX/openCypher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mats-SX/openCypher/statuses/{sha}","languages_url":"https://api.github.com/repos/Mats-SX/openCypher/languages","stargazers_url":"https://api.github.com/repos/Mats-SX/openCypher/stargazers","contributors_url":"https://api.github.com/repos/Mats-SX/openCypher/contributors","subscribers_url":"https://api.github.com/repos/Mats-SX/openCypher/subscribers","subscription_url":"https://api.github.com/repos/Mats-SX/openCypher/subscription","commits_url":"https://api.github.com/repos/Mats-SX/openCypher/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mats-SX/openCypher/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mats-SX/openCypher/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mats-SX/openCypher/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mats-SX/openCypher/contents/{+path}","compare_url":"https://api.github.com/repos/Mats-SX/openCypher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mats-SX/openCypher/merges","archive_url":"https://api.github.com/repos/Mats-SX/openCypher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mats-SX/openCypher/downloads","issues_url":"https://api.github.com/repos/Mats-SX/openCypher/issues{/number}","pulls_url":"https://api.github.com/repos/Mats-SX/openCypher/pulls{/number}","milestones_url":"https://api.github.com/repos/Mats-SX/openCypher/milestones{/number}","notifications_url":"https://api.github.com/repos/Mats-SX/openCypher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mats-SX/openCypher/labels{/name}","releases_url":"https://api.github.com/repos/Mats-SX/openCypher/releases{/id}","deployments_url":"https://api.github.com/repos/Mats-SX/openCypher/deployments","created_at":"2015-10-27T08:53:14Z","updated_at":"2016-02-10T12:26:32Z","pushed_at":"2016-07-15T15:50:53Z","git_url":"git://github.com/Mats-SX/openCypher.git","ssh_url":"git@github.com:Mats-SX/openCypher.git","clone_url":"https://github.com/Mats-SX/openCypher.git","svn_url":"https://github.com/Mats-SX/openCypher","homepage":null,"size":2310,"stargazers_count":0,"watchers_count":0,"language":"Cucumber","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"opencypher:master","ref":"master","sha":"87599e99c3e763e1172cf05020bf3b233795d197","user":{"login":"opencypher","id":14857376,"avatar_url":"https://avatars.githubusercontent.com/u/14857376?v=3","gravatar_id":"","url":"https://api.github.com/users/opencypher","html_url":"https://github.com/opencypher","followers_url":"https://api.github.com/users/opencypher/followers","following_url":"https://api.github.com/users/opencypher/following{/other_user}","gists_url":"https://api.github.com/users/opencypher/gists{/gist_id}","starred_url":"https://api.github.com/users/opencypher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencypher/subscriptions","organizations_url":"https://api.github.com/users/opencypher/orgs","repos_url":"https://api.github.com/users/opencypher/repos","events_url":"https://api.github.com/users/opencypher/events{/privacy}","received_events_url":"https://api.github.com/users/opencypher/received_events","type":"Organization","site_admin":false},"repo":{"id":30405191,"name":"openCypher","full_name":"opencypher/openCypher","owner":{"login":"opencypher","id":14857376,"avatar_url":"https://avatars.githubusercontent.com/u/14857376?v=3","gravatar_id":"","url":"https://api.github.com/users/opencypher","html_url":"https://github.com/opencypher","followers_url":"https://api.github.com/users/opencypher/followers","following_url":"https://api.github.com/users/opencypher/following{/other_user}","gists_url":"https://api.github.com/users/opencypher/gists{/gist_id}","starred_url":"https://api.github.com/users/opencypher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencypher/subscriptions","organizations_url":"https://api.github.com/users/opencypher/orgs","repos_url":"https://api.github.com/users/opencypher/repos","events_url":"https://api.github.com/users/opencypher/events{/privacy}","received_events_url":"https://api.github.com/users/opencypher/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opencypher/openCypher","description":"Specification of the Cypher query language","fork":false,"url":"https://api.github.com/repos/opencypher/openCypher","forks_url":"https://api.github.com/repos/opencypher/openCypher/forks","keys_url":"https://api.github.com/repos/opencypher/openCypher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencypher/openCypher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencypher/openCypher/teams","hooks_url":"https://api.github.com/repos/opencypher/openCypher/hooks","issue_events_url":"https://api.github.com/repos/opencypher/openCypher/issues/events{/number}","events_url":"https://api.github.com/repos/opencypher/openCypher/events","assignees_url":"https://api.github.com/repos/opencypher/openCypher/assignees{/user}","branches_url":"https://api.github.com/repos/opencypher/openCypher/branches{/branch}","tags_url":"https://api.github.com/repos/opencypher/openCypher/tags","blobs_url":"https://api.github.com/repos/opencypher/openCypher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencypher/openCypher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencypher/openCypher/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencypher/openCypher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencypher/openCypher/statuses/{sha}","languages_url":"https://api.github.com/repos/opencypher/openCypher/languages","stargazers_url":"https://api.github.com/repos/opencypher/openCypher/stargazers","contributors_url":"https://api.github.com/repos/opencypher/openCypher/contributors","subscribers_url":"https://api.github.com/repos/opencypher/openCypher/subscribers","subscription_url":"https://api.github.com/repos/opencypher/openCypher/subscription","commits_url":"https://api.github.com/repos/opencypher/openCypher/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencypher/openCypher/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencypher/openCypher/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencypher/openCypher/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencypher/openCypher/contents/{+path}","compare_url":"https://api.github.com/repos/opencypher/openCypher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencypher/openCypher/merges","archive_url":"https://api.github.com/repos/opencypher/openCypher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencypher/openCypher/downloads","issues_url":"https://api.github.com/repos/opencypher/openCypher/issues{/number}","pulls_url":"https://api.github.com/repos/opencypher/openCypher/pulls{/number}","milestones_url":"https://api.github.com/repos/opencypher/openCypher/milestones{/number}","notifications_url":"https://api.github.com/repos/opencypher/openCypher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencypher/openCypher/labels{/name}","releases_url":"https://api.github.com/repos/opencypher/openCypher/releases{/id}","deployments_url":"https://api.github.com/repos/opencypher/openCypher/deployments","created_at":"2015-02-06T09:35:42Z","updated_at":"2016-07-14T18:36:11Z","pushed_at":"2016-07-15T15:50:54Z","git_url":"git://github.com/opencypher/openCypher.git","ssh_url":"git@github.com:opencypher/openCypher.git","clone_url":"https://github.com/opencypher/openCypher.git","svn_url":"https://github.com/opencypher/openCypher","homepage":"http://www.opencypher.org","size":2401,"stargazers_count":87,"watchers_count":87,"language":"Cucumber","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":17,"forks":19,"open_issues":17,"watchers":87,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencypher/openCypher/pulls/111"},"html":{"href":"https://github.com/opencypher/openCypher/pull/111"},"issue":{"href":"https://api.github.com/repos/opencypher/openCypher/issues/111"},"comments":{"href":"https://api.github.com/repos/opencypher/openCypher/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/opencypher/openCypher/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/opencypher/openCypher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencypher/openCypher/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/opencypher/openCypher/statuses/c2a8bd4c6677cd7935bf712f0986fdf637d5a197"}}}}
{"actor":{"display_login":"Mats-SX"}}