{"action":"created","issue":{"url":"https://api.github.com/repos/Araq/Nim/issues/2859","labels_url":"https://api.github.com/repos/Araq/Nim/issues/2859/labels{/name}","comments_url":"https://api.github.com/repos/Araq/Nim/issues/2859/comments","events_url":"https://api.github.com/repos/Araq/Nim/issues/2859/events","html_url":"https://github.com/Araq/Nim/pull/2859","id":84187257,"number":2859,"title":"{.noRewrite.} pragma for term rewriting","user":{"login":"nanoant","id":103067,"avatar_url":"https://avatars.githubusercontent.com/u/103067?v=3","gravatar_id":"","url":"https://api.github.com/users/nanoant","html_url":"https://github.com/nanoant","followers_url":"https://api.github.com/users/nanoant/followers","following_url":"https://api.github.com/users/nanoant/following{/other_user}","gists_url":"https://api.github.com/users/nanoant/gists{/gist_id}","starred_url":"https://api.github.com/users/nanoant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nanoant/subscriptions","organizations_url":"https://api.github.com/users/nanoant/orgs","repos_url":"https://api.github.com/users/nanoant/repos","events_url":"https://api.github.com/users/nanoant/events{/privacy}","received_events_url":"https://api.github.com/users/nanoant/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-02T20:03:36Z","updated_at":"2015-06-04T13:29:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Araq/Nim/pulls/2859","html_url":"https://github.com/Araq/Nim/pull/2859","diff_url":"https://github.com/Araq/Nim/pull/2859.diff","patch_url":"https://github.com/Araq/Nim/pull/2859.patch"},"body":"@Araq As discussed on IRC, following PR is about two things.\r\n\r\n### {.noRewrite.} pragma\r\n\r\nWith new macro we can actually prevent further rewriting on marked piece of code, eg. with given example echo(...) will be rewritten just once:\r\n\r\n```nim\r\ntemplate pwnEcho{echo(x)}(x: expr) =\r\n  {.noRewrite.}: echo(\"pwned!\")\r\n\r\necho \"ab\"\r\n```\r\n\r\n### Attaching pragma to inline expr\r\n\r\nLast commit extends parser with ability to attach pragma to inline expr using parenthesis, eg.:\r\n\r\n```nim\r\ntemplate rewriteAdd{a + b}(a: expr, b: expr): expr =\r\n  ({.noRewrite.}: a + b) + 1\r\n```\r\n\r\nWaiting for your comments."},"comment":{"url":"https://api.github.com/repos/Araq/Nim/issues/comments/108899445","html_url":"https://github.com/Araq/Nim/pull/2859#issuecomment-108899445","issue_url":"https://api.github.com/repos/Araq/Nim/issues/2859","id":108899445,"user":{"login":"nanoant","id":103067,"avatar_url":"https://avatars.githubusercontent.com/u/103067?v=3","gravatar_id":"","url":"https://api.github.com/users/nanoant","html_url":"https://github.com/nanoant","followers_url":"https://api.github.com/users/nanoant/followers","following_url":"https://api.github.com/users/nanoant/following{/other_user}","gists_url":"https://api.github.com/users/nanoant/gists{/gist_id}","starred_url":"https://api.github.com/users/nanoant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nanoant/subscriptions","organizations_url":"https://api.github.com/users/nanoant/orgs","repos_url":"https://api.github.com/users/nanoant/repos","events_url":"https://api.github.com/users/nanoant/events{/privacy}","received_events_url":"https://api.github.com/users/nanoant/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T13:29:55Z","updated_at":"2015-06-04T13:29:55Z","body":"@Araq Okay thanks for you comment. Would you mind merging this as is, if aside of inability to block particular rewrite the change is not technically flawed?\r\n\r\nI promise then extending `{.noRewrite: macroOrTemplate.}` with optional symbol parameter, so if such symbol is given then it will be stored in list for `Node` and checked at TR pattern matching.\r\n\r\nAlso I am interested if you are okay with the other commits, particularly b0db812 (Inline expr pragmas with parenthesis), as this is important new feature to attach pragmas to parts of expr.\r\n"}}