{"action":"created","issue":{"url":"https://api.github.com/repos/manastech/crystal/issues/830","labels_url":"https://api.github.com/repos/manastech/crystal/issues/830/labels{/name}","comments_url":"https://api.github.com/repos/manastech/crystal/issues/830/comments","events_url":"https://api.github.com/repos/manastech/crystal/issues/830/events","html_url":"https://github.com/manastech/crystal/issues/830","id":89531195,"number":830,"title":"\"For\" Loop support","user":{"login":"daneb","id":1150821,"avatar_url":"https://avatars.githubusercontent.com/u/1150821?v=3","gravatar_id":"","url":"https://api.github.com/users/daneb","html_url":"https://github.com/daneb","followers_url":"https://api.github.com/users/daneb/followers","following_url":"https://api.github.com/users/daneb/following{/other_user}","gists_url":"https://api.github.com/users/daneb/gists{/gist_id}","starred_url":"https://api.github.com/users/daneb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daneb/subscriptions","organizations_url":"https://api.github.com/users/daneb/orgs","repos_url":"https://api.github.com/users/daneb/repos","events_url":"https://api.github.com/users/daneb/events{/privacy}","received_events_url":"https://api.github.com/users/daneb/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-06-19T10:42:26Z","updated_at":"2015-06-28T15:36:22Z","closed_at":"2015-06-19T12:03:03Z","body":"Hi\r\n\r\nI am well aware of https://github.com/manastech/crystal/issues/725#issuecomment-107708015 where \"for\" is proposed and it's suggested that \"iterators\" are sufficient.\r\n\r\nRuby does support \"for\" and it's referenced in benchmark.rb as part of stdlib documentation.\r\n\r\nSo my question - are we intentionally choosing not to support \"for\" as a design decision?\r\nI do see the keyword in lexer_spec.cr (line 132)\r\n\r\nThank you\r\n\r\nDane"},"comment":{"url":"https://api.github.com/repos/manastech/crystal/issues/comments/116292826","html_url":"https://github.com/manastech/crystal/issues/830#issuecomment-116292826","issue_url":"https://api.github.com/repos/manastech/crystal/issues/830","id":116292826,"user":{"login":"bcardiff","id":459923,"avatar_url":"https://avatars.githubusercontent.com/u/459923?v=3","gravatar_id":"","url":"https://api.github.com/users/bcardiff","html_url":"https://github.com/bcardiff","followers_url":"https://api.github.com/users/bcardiff/followers","following_url":"https://api.github.com/users/bcardiff/following{/other_user}","gists_url":"https://api.github.com/users/bcardiff/gists{/gist_id}","starred_url":"https://api.github.com/users/bcardiff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcardiff/subscriptions","organizations_url":"https://api.github.com/users/bcardiff/orgs","repos_url":"https://api.github.com/users/bcardiff/repos","events_url":"https://api.github.com/users/bcardiff/events{/privacy}","received_events_url":"https://api.github.com/users/bcardiff/received_events","type":"User","site_admin":false},"created_at":"2015-06-28T15:36:22Z","updated_at":"2015-06-28T15:36:22Z","body":"Yes @ozra, it should be doable with conditional macro branches :-)\r\n\r\n```crystal\r\nfor arr[i] = e do\r\n  puts e\r\nend\r\n```\r\n\r\nGenerates the following ast\r\n\r\n```\r\nCrystal::Call\r\n  @name:\r\n    for :: String\r\n  @args:\r\n    [0]\r\n    Crystal::Call\r\n      @obj:\r\n        Crystal::Call\r\n          @name:\r\n            arr :: String\r\n      @name:\r\n        []= :: String\r\n      @args:\r\n        [0]\r\n        Crystal::Call\r\n          @name:\r\n            i :: String\r\n        [1]\r\n        Crystal::Call\r\n          @name:\r\n            e :: String\r\n  @block:\r\n    Crystal::Block\r\n        @body:\r\n            ... puts e ast...\r\n```\r\n\r\nWhile\r\n```crystal\r\nfor e in arr do\r\n  puts e\r\nend\r\n```\r\n\r\n\r\nGenerates\r\n\r\n```\r\nCrystal::Call\r\n  @name:\r\n    for :: String\r\n  @args:\r\n    [0]\r\n    Crystal::Call\r\n      @name:\r\n        e :: String\r\n      @args:\r\n        [0]\r\n        Crystal::Call\r\n          @name:\r\n            in :: String\r\n          @args:\r\n            [0]\r\n            Crystal::Call\r\n              @name:\r\n                arr :: String\r\n          @block:\r\n            ... puts e ast...\r\n```\r\n\r\n\r\nWith that and the gist you should be able to get the desired macro.\r\n"}}