{"action":"created","issue":{"url":"https://api.github.com/repos/puppetlabs/puppet/issues/4578","labels_url":"https://api.github.com/repos/puppetlabs/puppet/issues/4578/labels{/name}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/issues/4578/comments","events_url":"https://api.github.com/repos/puppetlabs/puppet/issues/4578/events","html_url":"https://github.com/puppetlabs/puppet/pull/4578","id":127460305,"number":4578,"title":"(PUP-5648) Add Iterable and Iterator to Puppet Type System","user":{"login":"thallgren","id":209495,"avatar_url":"https://avatars.githubusercontent.com/u/209495?v=3","gravatar_id":"","url":"https://api.github.com/users/thallgren","html_url":"https://github.com/thallgren","followers_url":"https://api.github.com/users/thallgren/followers","following_url":"https://api.github.com/users/thallgren/following{/other_user}","gists_url":"https://api.github.com/users/thallgren/gists{/gist_id}","starred_url":"https://api.github.com/users/thallgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thallgren/subscriptions","organizations_url":"https://api.github.com/users/thallgren/orgs","repos_url":"https://api.github.com/users/thallgren/repos","events_url":"https://api.github.com/users/thallgren/events{/privacy}","received_events_url":"https://api.github.com/users/thallgren/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/puppetlabs/puppet/labels/Language","name":"Language","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-19T14:41:55Z","updated_at":"2016-01-29T09:30:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/4578","html_url":"https://github.com/puppetlabs/puppet/pull/4578","diff_url":"https://github.com/puppetlabs/puppet/pull/4578.diff","patch_url":"https://github.com/puppetlabs/puppet/pull/4578.patch"},"body":"This PR adds the new types `Iterable` and `Iterator` to the Puppet\r\ntype system together with the runtime support needed to represent an\r\nobject that has been transformed into an Iterator by a call to\r\n`Iterable.on`. This method transforms an instance of an object that\r\nPuppet can use in iterative functions into an Iterator. The Iterator\r\nin turn, provides basic support for the iterative functions.\r\n\r\nThe PR also changes the iterative functions `each`, `filter`,\r\n`map`, `reduce`, and `slice` so that the type of their declared\r\n_enumerable_ parameter is `Iterable` instead of `Any`"},"comment":{"url":"https://api.github.com/repos/puppetlabs/puppet/issues/comments/176661828","html_url":"https://github.com/puppetlabs/puppet/pull/4578#issuecomment-176661828","issue_url":"https://api.github.com/repos/puppetlabs/puppet/issues/4578","id":176661828,"user":{"login":"thallgren","id":209495,"avatar_url":"https://avatars.githubusercontent.com/u/209495?v=3","gravatar_id":"","url":"https://api.github.com/users/thallgren","html_url":"https://github.com/thallgren","followers_url":"https://api.github.com/users/thallgren/followers","following_url":"https://api.github.com/users/thallgren/following{/other_user}","gists_url":"https://api.github.com/users/thallgren/gists{/gist_id}","starred_url":"https://api.github.com/users/thallgren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thallgren/subscriptions","organizations_url":"https://api.github.com/users/thallgren/orgs","repos_url":"https://api.github.com/users/thallgren/repos","events_url":"https://api.github.com/users/thallgren/events{/privacy}","received_events_url":"https://api.github.com/users/thallgren/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T09:30:37Z","updated_at":"2016-01-29T09:30:37Z","body":"I would suggest that instead of repeating the long list of concrete `Iterable` objects in each function, we should say something short like \"Array, Hash, or other Iterable object\". It will be very cumbersome otherwise, to update each and every function when adding a new object that one can iterate over (and to remember that it must be done). It's also very confusing to mention that a String and an Integer are iterable without further explaining _how_ they are iterable. IMO, we must either leave them out and mention the Iterable as a concept explained elsewhere, or explain that concept it in every function."}}