{"action":"created","issue":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/516","labels_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/516/labels{/name}","comments_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/516/comments","events_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/516/events","html_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/516","id":103788824,"number":516,"title":"Adds an is_a() function","user":{"login":"binford2k","id":1392917,"avatar_url":"https://avatars.githubusercontent.com/u/1392917?v=3","gravatar_id":"","url":"https://api.github.com/users/binford2k","html_url":"https://github.com/binford2k","followers_url":"https://api.github.com/users/binford2k/followers","following_url":"https://api.github.com/users/binford2k/following{/other_user}","gists_url":"https://api.github.com/users/binford2k/gists{/gist_id}","starred_url":"https://api.github.com/users/binford2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binford2k/subscriptions","organizations_url":"https://api.github.com/users/binford2k/orgs","repos_url":"https://api.github.com/users/binford2k/repos","events_url":"https://api.github.com/users/binford2k/events{/privacy}","received_events_url":"https://api.github.com/users/binford2k/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-28T20:17:20Z","updated_at":"2015-09-03T13:18:08Z","closed_at":"2015-09-01T17:22:29Z","pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/pulls/516","html_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/516","diff_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/516.diff","patch_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/516.patch"},"body":"The data type system is very hard to understand. Many people don't understand why\r\n\r\n    type_of([1,2,3]) == Array\r\n\r\nwill fail, but\r\n\r\n    type_of([1,2,3]) <= Array\r\n\r\npasses. This does a simpler validation that doesn't rely on explicit data types. Instead, use\r\n\r\n    $foo = [1,2,3]\r\n    if $foo.is_a(Array) {\r\n      notify { 'This is an array': }\r\n    }"},"comment":{"url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/comments/137440777","html_url":"https://github.com/puppetlabs/puppetlabs-stdlib/pull/516#issuecomment-137440777","issue_url":"https://api.github.com/repos/puppetlabs/puppetlabs-stdlib/issues/516","id":137440777,"user":{"login":"hlindberg","id":563066,"avatar_url":"https://avatars.githubusercontent.com/u/563066?v=3","gravatar_id":"","url":"https://api.github.com/users/hlindberg","html_url":"https://github.com/hlindberg","followers_url":"https://api.github.com/users/hlindberg/followers","following_url":"https://api.github.com/users/hlindberg/following{/other_user}","gists_url":"https://api.github.com/users/hlindberg/gists{/gist_id}","starred_url":"https://api.github.com/users/hlindberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hlindberg/subscriptions","organizations_url":"https://api.github.com/users/hlindberg/orgs","repos_url":"https://api.github.com/users/hlindberg/repos","events_url":"https://api.github.com/users/hlindberg/events{/privacy}","received_events_url":"https://api.github.com/users/hlindberg/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T13:18:08Z","updated_at":"2015-09-03T13:18:08Z","body":"In any case (if this makes it in or not), the parameters are in the wrong order - the instance value should be the first parameter so you can write `$x.is_a(String)`. The function should also type check its arguments i.e. (Any, Type)."}}