{"action":"created","issue":{"url":"https://api.github.com/repos/wc-duck/datalibrary/issues/46","repository_url":"https://api.github.com/repos/wc-duck/datalibrary","labels_url":"https://api.github.com/repos/wc-duck/datalibrary/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/wc-duck/datalibrary/issues/46/comments","events_url":"https://api.github.com/repos/wc-duck/datalibrary/issues/46/events","html_url":"https://github.com/wc-duck/datalibrary/issues/46","id":150916958,"number":46,"title":"Add support for unions.","user":{"login":"wc-duck","id":378426,"avatar_url":"https://avatars.githubusercontent.com/u/378426?v=3","gravatar_id":"","url":"https://api.github.com/users/wc-duck","html_url":"https://github.com/wc-duck","followers_url":"https://api.github.com/users/wc-duck/followers","following_url":"https://api.github.com/users/wc-duck/following{/other_user}","gists_url":"https://api.github.com/users/wc-duck/gists{/gist_id}","starred_url":"https://api.github.com/users/wc-duck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wc-duck/subscriptions","organizations_url":"https://api.github.com/users/wc-duck/orgs","repos_url":"https://api.github.com/users/wc-duck/repos","events_url":"https://api.github.com/users/wc-duck/events{/privacy}","received_events_url":"https://api.github.com/users/wc-duck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-04-25T16:23:20Z","updated_at":"2016-08-22T20:31:43Z","closed_at":null,"body":"Support for union types has been requested from both users and myself, so that should be added. Here is my suggestion for interface.\r\n\r\ntypelib:\r\n```javascript\r\n\r\n    {\r\n        // add new section \"unions\" to typelib.\r\n        \"unions\" : {\r\n            \"my_union_type\" : {\r\n               // this would be the actual name of the union, see below. ( not the best name for the key =/ )\r\n               \"name\" : \"v\", \r\n\r\n                // defined as dict, it could also be defined as a [] to match \"types\"?\r\n                \"members\" : {\r\n                    \"member_1\" : \"other_defined_type1\",\r\n                    \"member_2\" : \"other_defined_type2\"\r\n                }\r\n            }\r\n        }\r\n    }\r\n```\r\n\r\nthis would generate this type-header\r\n```c\r\nstruct my_union_type\r\n{\r\n    dl_typeid_t type; // type currently present in union\r\n    union\r\n    {\r\n        other_defined_type1 member_1;\r\n        other_defined_type2 member_2;\r\n    } v;\r\n};\r\n```\r\nHowever I have no really good idea for how to specify this in the text format yet =/ Lets say that we have a type with a member \"union_member\" of the above defined type, like this:\r\n\r\n```c\r\nstruct the_type\r\n{\r\n    union_type union_member;\r\n};\r\n```\r\nhow would that be specified in text-data ( how would the text-data specify what member to actually initialize? Maybe like this?\r\n\r\n```javascript\r\n{\r\n    \"the_type\" : {\r\n        \"union_member\" : {\r\n            \"member_1\" : {\r\n                // ... other_defined_type1 data here ...\r\n            },\r\n            // ... setting more than one member would be an error ...\r\n        }\r\n    }\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/wc-duck/datalibrary/issues/comments/241540393","html_url":"https://github.com/wc-duck/datalibrary/issues/46#issuecomment-241540393","issue_url":"https://api.github.com/repos/wc-duck/datalibrary/issues/46","id":241540393,"user":{"login":"wc-duck","id":378426,"avatar_url":"https://avatars.githubusercontent.com/u/378426?v=3","gravatar_id":"","url":"https://api.github.com/users/wc-duck","html_url":"https://github.com/wc-duck","followers_url":"https://api.github.com/users/wc-duck/followers","following_url":"https://api.github.com/users/wc-duck/following{/other_user}","gists_url":"https://api.github.com/users/wc-duck/gists{/gist_id}","starred_url":"https://api.github.com/users/wc-duck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wc-duck/subscriptions","organizations_url":"https://api.github.com/users/wc-duck/orgs","repos_url":"https://api.github.com/users/wc-duck/repos","events_url":"https://api.github.com/users/wc-duck/events{/privacy}","received_events_url":"https://api.github.com/users/wc-duck/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T20:31:43Z","updated_at":"2016-08-22T20:31:43Z","body":"As a small update I have unions working locally, just need to add some tests and cleanup the implementation a bit, will hopefully submit something rough during the week."}}
{"actor":{"display_login":"wc-duck"}}