{"action":"opened","number":144,"pull_request":{"url":"https://api.github.com/repos/Gozala/wisp/pulls/144","id":63037851,"html_url":"https://github.com/Gozala/wisp/pull/144","diff_url":"https://github.com/Gozala/wisp/pull/144.diff","patch_url":"https://github.com/Gozala/wisp/pull/144.patch","issue_url":"https://api.github.com/repos/Gozala/wisp/issues/144","number":144,"state":"open","locked":false,"title":"repl:Fix slicing first character(#141)","user":{"login":"pocka","id":13316015,"avatar_url":"https://avatars.githubusercontent.com/u/13316015?v=3","gravatar_id":"","url":"https://api.github.com/users/pocka","html_url":"https://github.com/pocka","followers_url":"https://api.github.com/users/pocka/followers","following_url":"https://api.github.com/users/pocka/following{/other_user}","gists_url":"https://api.github.com/users/pocka/gists{/gist_id}","starred_url":"https://api.github.com/users/pocka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocka/subscriptions","organizations_url":"https://api.github.com/users/pocka/orgs","repos_url":"https://api.github.com/users/pocka/repos","events_url":"https://api.github.com/users/pocka/events{/privacy}","received_events_url":"https://api.github.com/users/pocka/received_events","type":"User","site_admin":false},"body":"Fixed #141 .\r\n\r\nThis bug occurred in node v0.11.7 or later due to node's changing behaviour of its repl.\r\n\r\nUntil node v0.11.6, user input string passed to evaluate function always wrapped with paren.\r\n```javascript\r\n> 1+1;\r\n'(' + '1+1;' + '\\n' + ')'\r\n```\r\nSo, wisp's repl removes this automatically added parens by `(subs code 1 (- (count code) 1))` (code=user input string).\r\n\r\nBut since [this commit](https://github.com/nodejs/node/commit/9ef9a9dee54a464a46739b14e8a348bec673c5a5#diff-b13d72249263845d8e8341db0426f9d3L258) ,\r\nonly input string wrapped with curly brace would be wrapped with paren, other inputs are passed directly.\r\nAdditionaly, position of `\\n` is also changed (to tail, not inside of parens).\r\n```javascript\r\n> 1+1;\r\n'1+1;' + '\\n'\r\n> { a: \"b\" }\r\n'(' + '{ a: \"b\" }' + ')' + '\\n'\r\n```\r\n\r\n..But wisp's repl doesn't know this, so it removes first and last character and tries to evaluate it.\r\nThis causes slicing first character (and last LF) in node v0.11.7~.\r\n```wisp\r\n=> (console.log \"wisp\") ;; '(console.log \"wisp\" )\\n' -> 'console.log \"wisp\")'\r\n SyntaxError: Unmatched delimiter \r\n```\r\n\r\nChecking the last character of input string is equal to checking node version(`\\n`:v0.11.7~ , `)`:~v0.11.6).\r\nSo this workaround does:\r\n+ if the last character is not `\\n`(= `)` ), remove outermost parens(~v0.11.6)\r\n+ if the last character is `\\n`, pass input directly(v0.11.7~)\r\n\r\n(Sorry for my poor English)","created_at":"2016-03-16T09:53:59Z","updated_at":"2016-03-16T09:53:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Gozala/wisp/pulls/144/commits","review_comments_url":"https://api.github.com/repos/Gozala/wisp/pulls/144/comments","review_comment_url":"https://api.github.com/repos/Gozala/wisp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Gozala/wisp/issues/144/comments","statuses_url":"https://api.github.com/repos/Gozala/wisp/statuses/119a1efa8d0029790a810a51e3c595993331d506","head":{"label":"pocka:fix/repl-slicing","ref":"fix/repl-slicing","sha":"119a1efa8d0029790a810a51e3c595993331d506","user":{"login":"pocka","id":13316015,"avatar_url":"https://avatars.githubusercontent.com/u/13316015?v=3","gravatar_id":"","url":"https://api.github.com/users/pocka","html_url":"https://github.com/pocka","followers_url":"https://api.github.com/users/pocka/followers","following_url":"https://api.github.com/users/pocka/following{/other_user}","gists_url":"https://api.github.com/users/pocka/gists{/gist_id}","starred_url":"https://api.github.com/users/pocka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocka/subscriptions","organizations_url":"https://api.github.com/users/pocka/orgs","repos_url":"https://api.github.com/users/pocka/repos","events_url":"https://api.github.com/users/pocka/events{/privacy}","received_events_url":"https://api.github.com/users/pocka/received_events","type":"User","site_admin":false},"repo":{"id":53879595,"name":"wisp","full_name":"pocka/wisp","owner":{"login":"pocka","id":13316015,"avatar_url":"https://avatars.githubusercontent.com/u/13316015?v=3","gravatar_id":"","url":"https://api.github.com/users/pocka","html_url":"https://github.com/pocka","followers_url":"https://api.github.com/users/pocka/followers","following_url":"https://api.github.com/users/pocka/following{/other_user}","gists_url":"https://api.github.com/users/pocka/gists{/gist_id}","starred_url":"https://api.github.com/users/pocka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocka/subscriptions","organizations_url":"https://api.github.com/users/pocka/orgs","repos_url":"https://api.github.com/users/pocka/repos","events_url":"https://api.github.com/users/pocka/events{/privacy}","received_events_url":"https://api.github.com/users/pocka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pocka/wisp","description":"Homoiconic JS with clojure syntax, s-expressions & macros","fork":true,"url":"https://api.github.com/repos/pocka/wisp","forks_url":"https://api.github.com/repos/pocka/wisp/forks","keys_url":"https://api.github.com/repos/pocka/wisp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pocka/wisp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pocka/wisp/teams","hooks_url":"https://api.github.com/repos/pocka/wisp/hooks","issue_events_url":"https://api.github.com/repos/pocka/wisp/issues/events{/number}","events_url":"https://api.github.com/repos/pocka/wisp/events","assignees_url":"https://api.github.com/repos/pocka/wisp/assignees{/user}","branches_url":"https://api.github.com/repos/pocka/wisp/branches{/branch}","tags_url":"https://api.github.com/repos/pocka/wisp/tags","blobs_url":"https://api.github.com/repos/pocka/wisp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pocka/wisp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pocka/wisp/git/refs{/sha}","trees_url":"https://api.github.com/repos/pocka/wisp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pocka/wisp/statuses/{sha}","languages_url":"https://api.github.com/repos/pocka/wisp/languages","stargazers_url":"https://api.github.com/repos/pocka/wisp/stargazers","contributors_url":"https://api.github.com/repos/pocka/wisp/contributors","subscribers_url":"https://api.github.com/repos/pocka/wisp/subscribers","subscription_url":"https://api.github.com/repos/pocka/wisp/subscription","commits_url":"https://api.github.com/repos/pocka/wisp/commits{/sha}","git_commits_url":"https://api.github.com/repos/pocka/wisp/git/commits{/sha}","comments_url":"https://api.github.com/repos/pocka/wisp/comments{/number}","issue_comment_url":"https://api.github.com/repos/pocka/wisp/issues/comments{/number}","contents_url":"https://api.github.com/repos/pocka/wisp/contents/{+path}","compare_url":"https://api.github.com/repos/pocka/wisp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pocka/wisp/merges","archive_url":"https://api.github.com/repos/pocka/wisp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pocka/wisp/downloads","issues_url":"https://api.github.com/repos/pocka/wisp/issues{/number}","pulls_url":"https://api.github.com/repos/pocka/wisp/pulls{/number}","milestones_url":"https://api.github.com/repos/pocka/wisp/milestones{/number}","notifications_url":"https://api.github.com/repos/pocka/wisp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pocka/wisp/labels{/name}","releases_url":"https://api.github.com/repos/pocka/wisp/releases{/id}","deployments_url":"https://api.github.com/repos/pocka/wisp/deployments","created_at":"2016-03-14T18:07:53Z","updated_at":"2016-03-14T18:07:54Z","pushed_at":"2016-03-16T08:51:43Z","git_url":"git://github.com/pocka/wisp.git","ssh_url":"git@github.com:pocka/wisp.git","clone_url":"https://github.com/pocka/wisp.git","svn_url":"https://github.com/pocka/wisp","homepage":"http://jeditoolkit.com/wisp/","size":1752,"stargazers_count":0,"watchers_count":0,"language":"wisp","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":"Gozala:master","ref":"master","sha":"3e7596a861bb17b621ab7e5f50aff206cc72d119","user":{"login":"Gozala","id":21236,"avatar_url":"https://avatars.githubusercontent.com/u/21236?v=3","gravatar_id":"","url":"https://api.github.com/users/Gozala","html_url":"https://github.com/Gozala","followers_url":"https://api.github.com/users/Gozala/followers","following_url":"https://api.github.com/users/Gozala/following{/other_user}","gists_url":"https://api.github.com/users/Gozala/gists{/gist_id}","starred_url":"https://api.github.com/users/Gozala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gozala/subscriptions","organizations_url":"https://api.github.com/users/Gozala/orgs","repos_url":"https://api.github.com/users/Gozala/repos","events_url":"https://api.github.com/users/Gozala/events{/privacy}","received_events_url":"https://api.github.com/users/Gozala/received_events","type":"User","site_admin":false},"repo":{"id":6002709,"name":"wisp","full_name":"Gozala/wisp","owner":{"login":"Gozala","id":21236,"avatar_url":"https://avatars.githubusercontent.com/u/21236?v=3","gravatar_id":"","url":"https://api.github.com/users/Gozala","html_url":"https://github.com/Gozala","followers_url":"https://api.github.com/users/Gozala/followers","following_url":"https://api.github.com/users/Gozala/following{/other_user}","gists_url":"https://api.github.com/users/Gozala/gists{/gist_id}","starred_url":"https://api.github.com/users/Gozala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gozala/subscriptions","organizations_url":"https://api.github.com/users/Gozala/orgs","repos_url":"https://api.github.com/users/Gozala/repos","events_url":"https://api.github.com/users/Gozala/events{/privacy}","received_events_url":"https://api.github.com/users/Gozala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Gozala/wisp","description":"Homoiconic JS with clojure syntax, s-expressions & macros","fork":false,"url":"https://api.github.com/repos/Gozala/wisp","forks_url":"https://api.github.com/repos/Gozala/wisp/forks","keys_url":"https://api.github.com/repos/Gozala/wisp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Gozala/wisp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Gozala/wisp/teams","hooks_url":"https://api.github.com/repos/Gozala/wisp/hooks","issue_events_url":"https://api.github.com/repos/Gozala/wisp/issues/events{/number}","events_url":"https://api.github.com/repos/Gozala/wisp/events","assignees_url":"https://api.github.com/repos/Gozala/wisp/assignees{/user}","branches_url":"https://api.github.com/repos/Gozala/wisp/branches{/branch}","tags_url":"https://api.github.com/repos/Gozala/wisp/tags","blobs_url":"https://api.github.com/repos/Gozala/wisp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Gozala/wisp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Gozala/wisp/git/refs{/sha}","trees_url":"https://api.github.com/repos/Gozala/wisp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Gozala/wisp/statuses/{sha}","languages_url":"https://api.github.com/repos/Gozala/wisp/languages","stargazers_url":"https://api.github.com/repos/Gozala/wisp/stargazers","contributors_url":"https://api.github.com/repos/Gozala/wisp/contributors","subscribers_url":"https://api.github.com/repos/Gozala/wisp/subscribers","subscription_url":"https://api.github.com/repos/Gozala/wisp/subscription","commits_url":"https://api.github.com/repos/Gozala/wisp/commits{/sha}","git_commits_url":"https://api.github.com/repos/Gozala/wisp/git/commits{/sha}","comments_url":"https://api.github.com/repos/Gozala/wisp/comments{/number}","issue_comment_url":"https://api.github.com/repos/Gozala/wisp/issues/comments{/number}","contents_url":"https://api.github.com/repos/Gozala/wisp/contents/{+path}","compare_url":"https://api.github.com/repos/Gozala/wisp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Gozala/wisp/merges","archive_url":"https://api.github.com/repos/Gozala/wisp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Gozala/wisp/downloads","issues_url":"https://api.github.com/repos/Gozala/wisp/issues{/number}","pulls_url":"https://api.github.com/repos/Gozala/wisp/pulls{/number}","milestones_url":"https://api.github.com/repos/Gozala/wisp/milestones{/number}","notifications_url":"https://api.github.com/repos/Gozala/wisp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Gozala/wisp/labels{/name}","releases_url":"https://api.github.com/repos/Gozala/wisp/releases{/id}","deployments_url":"https://api.github.com/repos/Gozala/wisp/deployments","created_at":"2012-09-28T20:30:24Z","updated_at":"2016-03-14T15:41:02Z","pushed_at":"2015-11-20T21:10:20Z","git_url":"git://github.com/Gozala/wisp.git","ssh_url":"git@github.com:Gozala/wisp.git","clone_url":"https://github.com/Gozala/wisp.git","svn_url":"https://github.com/Gozala/wisp","homepage":"http://jeditoolkit.com/wisp/","size":3074,"stargazers_count":783,"watchers_count":783,"language":"wisp","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":46,"mirror_url":null,"open_issues_count":60,"forks":46,"open_issues":60,"watchers":783,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Gozala/wisp/pulls/144"},"html":{"href":"https://github.com/Gozala/wisp/pull/144"},"issue":{"href":"https://api.github.com/repos/Gozala/wisp/issues/144"},"comments":{"href":"https://api.github.com/repos/Gozala/wisp/issues/144/comments"},"review_comments":{"href":"https://api.github.com/repos/Gozala/wisp/pulls/144/comments"},"review_comment":{"href":"https://api.github.com/repos/Gozala/wisp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Gozala/wisp/pulls/144/commits"},"statuses":{"href":"https://api.github.com/repos/Gozala/wisp/statuses/119a1efa8d0029790a810a51e3c595993331d506"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":5,"deletions":2,"changed_files":1}}