{"action":"created","issue":{"url":"https://api.github.com/repos/privat/nit/issues/1339","labels_url":"https://api.github.com/repos/privat/nit/issues/1339/labels{/name}","comments_url":"https://api.github.com/repos/privat/nit/issues/1339/comments","events_url":"https://api.github.com/repos/privat/nit/issues/1339/events","html_url":"https://github.com/privat/nit/issues/1339","id":76083717,"number":1339,"title":"Syntax and semantic of the range","user":{"login":"privat","id":135828,"avatar_url":"https://avatars.githubusercontent.com/u/135828?v=3","gravatar_id":"","url":"https://api.github.com/users/privat","html_url":"https://github.com/privat","followers_url":"https://api.github.com/users/privat/followers","following_url":"https://api.github.com/users/privat/following{/other_user}","gists_url":"https://api.github.com/users/privat/gists{/gist_id}","starred_url":"https://api.github.com/users/privat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privat/subscriptions","organizations_url":"https://api.github.com/users/privat/orgs","repos_url":"https://api.github.com/users/privat/repos","events_url":"https://api.github.com/users/privat/events{/privacy}","received_events_url":"https://api.github.com/users/privat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/privat/nit/labels/request_for_comments","name":"request_for_comments","color":"ffb4f2"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/privat/nit/milestones/4","html_url":"https://github.com/privat/nit/milestones/v1.0prealpha","labels_url":"https://api.github.com/repos/privat/nit/milestones/4/labels","id":795157,"number":4,"title":"v1.0prealpha","description":"The first public version that we are proud off and can be used sanely by non Nit people.","creator":{"login":"privat","id":135828,"avatar_url":"https://avatars.githubusercontent.com/u/135828?v=3","gravatar_id":"","url":"https://api.github.com/users/privat","html_url":"https://github.com/privat","followers_url":"https://api.github.com/users/privat/followers","following_url":"https://api.github.com/users/privat/following{/other_user}","gists_url":"https://api.github.com/users/privat/gists{/gist_id}","starred_url":"https://api.github.com/users/privat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privat/subscriptions","organizations_url":"https://api.github.com/users/privat/orgs","repos_url":"https://api.github.com/users/privat/repos","events_url":"https://api.github.com/users/privat/events{/privacy}","received_events_url":"https://api.github.com/users/privat/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":8,"state":"open","created_at":"2014-09-19T00:16:45Z","updated_at":"2015-05-13T18:44:01Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2015-05-13T18:44:01Z","updated_at":"2015-05-13T19:39:57Z","closed_at":null,"body":"The Nit range notation and semantic is very old and predate the current days where most modern languages offer a basic range type with a notation for literals.\r\n\r\nMaybe some improvement can be done\r\n\r\n## Syntax\r\n\r\n* Nit `[1..5[` and `[1..5]`\r\n* Ruby `1...5` and `1..5`\r\n* Groovy `1..<5` and `1..5`\r\n* Coffeescript `[1...5]` and `[1..5]`\r\n* Python `range(1, 5)` (no inclusive range)\r\n* Scala `(1 until 5)`  and `(1 to 5)`\r\n* Swift `1..<5` and `1...5` (yes `...` for inclusive range, wtf!?)\r\n\r\n## Range with steps\r\n\r\n* Ruby: use a generator `1.step(4,2)` or `(1...5).step(2)`\r\n* Python: `range(1,5,2)`\r\n* Scala: `(1 until 5 by 2)`\r\n\r\n## Reverse range\r\n\r\nWhat is the behavior of `[10..5[` (or equivalent syntax)\r\n\r\nEmpty range: Nit, Ruby, Python\r\nReverse range: CoffeeScript\r\n\r\nHow to iterate in a reverse order?\r\n\r\n* Ruby: use a generator `10.downto(6)`\r\n* Python: use a negative step `range(10,5,-1)`\r\n* Scala: use a negative step `(10 until 5 by -1)`\r\n* Swift: use  `(10..<5).reverse()`"},"comment":{"url":"https://api.github.com/repos/privat/nit/issues/comments/101789849","html_url":"https://github.com/privat/nit/issues/1339#issuecomment-101789849","issue_url":"https://api.github.com/repos/privat/nit/issues/1339","id":101789849,"user":{"login":"egagnon","id":135806,"avatar_url":"https://avatars.githubusercontent.com/u/135806?v=3","gravatar_id":"","url":"https://api.github.com/users/egagnon","html_url":"https://github.com/egagnon","followers_url":"https://api.github.com/users/egagnon/followers","following_url":"https://api.github.com/users/egagnon/following{/other_user}","gists_url":"https://api.github.com/users/egagnon/gists{/gist_id}","starred_url":"https://api.github.com/users/egagnon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egagnon/subscriptions","organizations_url":"https://api.github.com/users/egagnon/orgs","repos_url":"https://api.github.com/users/egagnon/repos","events_url":"https://api.github.com/users/egagnon/events{/privacy}","received_events_url":"https://api.github.com/users/egagnon/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T19:39:57Z","updated_at":"2015-05-13T19:39:57Z","body":"I still think that ```step``` outside is clearer and more intuitive.\r\n\r\nJust forget about the lexer/parser mess, for a second, and look at it. Don't you find it simple and clean?\r\nYou could write:\r\n```\r\nvar r = [0..10[ step 2  # 0,2,4,6,8\r\n```\r\nBut, you can do what you want. I won't fight more about it."}}