{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/6507","repository_url":"https://api.github.com/repos/nim-lang/Nim","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/6507/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/6507/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/6507/events","html_url":"https://github.com/nim-lang/Nim/pull/6507","id":265479263,"number":6507,"title":"Add string interpolation from nimboost","user":{"login":"bluenote10","id":3620703,"avatar_url":"https://avatars1.githubusercontent.com/u/3620703?v=4","gravatar_id":"","url":"https://api.github.com/users/bluenote10","html_url":"https://github.com/bluenote10","followers_url":"https://api.github.com/users/bluenote10/followers","following_url":"https://api.github.com/users/bluenote10/following{/other_user}","gists_url":"https://api.github.com/users/bluenote10/gists{/gist_id}","starred_url":"https://api.github.com/users/bluenote10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bluenote10/subscriptions","organizations_url":"https://api.github.com/users/bluenote10/orgs","repos_url":"https://api.github.com/users/bluenote10/repos","events_url":"https://api.github.com/users/bluenote10/events{/privacy}","received_events_url":"https://api.github.com/users/bluenote10/received_events","type":"User","site_admin":false},"labels":[{"id":66122,"url":"https://api.github.com/repos/nim-lang/Nim/labels/Feature","name":"Feature","color":"0080f0","default":false},{"id":101971351,"url":"https://api.github.com/repos/nim-lang/Nim/labels/Stdlib","name":"Stdlib","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-10-14T09:48:28Z","updated_at":"2017-10-24T08:45:42Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/nim-lang/Nim/pulls/6507","html_url":"https://github.com/nim-lang/Nim/pull/6507","diff_url":"https://github.com/nim-lang/Nim/pull/6507.diff","patch_url":"https://github.com/nim-lang/Nim/pull/6507.patch"},"body":"As discussed in #5600, this PR adds @vegansk nice string interpolation implementation from [nimboost](https://github.com/vegansk/nimboost) to the standard library.\r\n\r\nTo discuss: Should this live in a separate module or in `strutils`? If separate, what's a good name?\r\n\r\nIn nimboost, the implementation relies on 4 modules: [`richstring`](https://github.com/vegansk/nimboost/blob/bed721cd10e5c620b3e8f14ba0983d99681a7cab/src/boost/richstring.nim), [`parsers`](https://github.com/vegansk/nimboost/blob/bed721cd10e5c620b3e8f14ba0983d99681a7cab/src/boost/parsers.nim), [`formatters`](https://github.com/vegansk/nimboost/blob/bed721cd10e5c620b3e8f14ba0983d99681a7cab/src/boost/formatters.nim), and [`limits`](https://github.com/vegansk/nimboost/blob/bed721cd10e5c620b3e8f14ba0983d99681a7cab/src/boost/limits.nim). I minified the implementation by using `parseInt` instead of nimboost's `strToInt`. This gets rid of the requirements on `limits` and `parsers`, but I'm not sure if using `strToInt` would have any benefits. The remaining things fit reasonably into one module. Should we consider to `include` it from `strutils` so that users don't need an extra `import` for string interpolation while keeping the implementation clean and separated?\r\n\r\nCC @Yardanico \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/comments/338919024","html_url":"https://github.com/nim-lang/Nim/pull/6507#issuecomment-338919024","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/6507","id":338919024,"user":{"login":"Araq","id":287816,"avatar_url":"https://avatars1.githubusercontent.com/u/287816?v=4","gravatar_id":"","url":"https://api.github.com/users/Araq","html_url":"https://github.com/Araq","followers_url":"https://api.github.com/users/Araq/followers","following_url":"https://api.github.com/users/Araq/following{/other_user}","gists_url":"https://api.github.com/users/Araq/gists{/gist_id}","starred_url":"https://api.github.com/users/Araq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Araq/subscriptions","organizations_url":"https://api.github.com/users/Araq/orgs","repos_url":"https://api.github.com/users/Araq/repos","events_url":"https://api.github.com/users/Araq/events{/privacy}","received_events_url":"https://api.github.com/users/Araq/received_events","type":"User","site_admin":false},"created_at":"2017-10-24T08:45:42Z","updated_at":"2017-10-24T08:45:42Z","author_association":"OWNER","body":"I don't agree with these design decisions. :-) The problem is that single letter format specifiers do not scale, so the first step is to allow multiple characters here:\r\n\r\n```\r\n${x}s  # short for\r\n${x}s$\r\n```\r\n\r\nWith this optional terminating ``$`` we have an extensible syntax that can keep things sane:\r\n\r\n```\r\n${x}size kb$ # with space, always in kb\r\n${x}size_kb$ # without space, always in kb\r\n${x}size_$ # choose the right suffix, no space\r\n${x}size $  # choose the right suffx, with space\r\n${x}time 00:00:00$ # oh look, times work too\r\n````\r\n"}}
{"actor":{"display_login":"Araq"}}