{"action":"created","issue":{"url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/236","labels_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/236/comments","events_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/236/events","html_url":"https://github.com/CausalityLtd/ponyc/issues/236","id":85900223,"number":236,"title":"how to match on generics","user":{"login":"d3m1gd","id":3992031,"avatar_url":"https://avatars.githubusercontent.com/u/3992031?v=3","gravatar_id":"","url":"https://api.github.com/users/d3m1gd","html_url":"https://github.com/d3m1gd","followers_url":"https://api.github.com/users/d3m1gd/followers","following_url":"https://api.github.com/users/d3m1gd/following{/other_user}","gists_url":"https://api.github.com/users/d3m1gd/gists{/gist_id}","starred_url":"https://api.github.com/users/d3m1gd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d3m1gd/subscriptions","organizations_url":"https://api.github.com/users/d3m1gd/orgs","repos_url":"https://api.github.com/users/d3m1gd/repos","events_url":"https://api.github.com/users/d3m1gd/events{/privacy}","received_events_url":"https://api.github.com/users/d3m1gd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-07T13:01:02Z","updated_at":"2015-06-08T16:03:32Z","closed_at":"2015-06-08T10:29:42Z","body":"Question is: how to properly match on generic parameters, and speciefically on Array of pairs of generics =)\r\n\r\nFollowing code does not compile due to 'never match':\r\n\r\n    class Foo[A: (String val|I64)]\r\n      let array: Array[(U32,A)] = array.create()\r\n    \r\n      fun ref add(id: U32, arg: A) => array.push((id,arg))\r\n    \r\n      fun get() =>\r\n        match array\r\n        | let a: Array[(U32,String val)] => None\r\n        end\r\n    \r\n    actor Main\r\n      new create(env: Env) =>\r\n        None\r\n\r\n\r\nWith following workaround i am able to express my idea, code compiles:\r\n\r\n    class Foo[A: (String val|I64)]\r\n      let array: Array[(U32,A)] = array.create()\r\n    \r\n      fun ref add(id: U32, arg: A) => array.push((id,arg))\r\n    \r\n      fun get() =>\r\n        try\r\n          match array(0)\r\n          | (let a: U32, let b: String val) => None\r\n          end\r\n        end\r\n    \r\n    actor Main\r\n      new create(env: Env) =>\r\n        None\r\n"},"comment":{"url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/comments/110054097","html_url":"https://github.com/CausalityLtd/ponyc/issues/236#issuecomment-110054097","issue_url":"https://api.github.com/repos/CausalityLtd/ponyc/issues/236","id":110054097,"user":{"login":"d3m1gd","id":3992031,"avatar_url":"https://avatars.githubusercontent.com/u/3992031?v=3","gravatar_id":"","url":"https://api.github.com/users/d3m1gd","html_url":"https://github.com/d3m1gd","followers_url":"https://api.github.com/users/d3m1gd/followers","following_url":"https://api.github.com/users/d3m1gd/following{/other_user}","gists_url":"https://api.github.com/users/d3m1gd/gists{/gist_id}","starred_url":"https://api.github.com/users/d3m1gd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d3m1gd/subscriptions","organizations_url":"https://api.github.com/users/d3m1gd/orgs","repos_url":"https://api.github.com/users/d3m1gd/repos","events_url":"https://api.github.com/users/d3m1gd/events{/privacy}","received_events_url":"https://api.github.com/users/d3m1gd/received_events","type":"User","site_admin":false},"created_at":"2015-06-08T16:03:32Z","updated_at":"2015-06-08T16:03:32Z","body":"indeed, tnanks again!\r\n\r\n`this->` part is the hardest thing for me to understand in Pony so far =(\r\n\r\nreally hope for a tutorial 'for dummies'"}}