{"action":"created","issue":{"url":"https://api.github.com/repos/cling-lang/spec/issues/1","labels_url":"https://api.github.com/repos/cling-lang/spec/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/cling-lang/spec/issues/1/comments","events_url":"https://api.github.com/repos/cling-lang/spec/issues/1/events","html_url":"https://github.com/cling-lang/spec/issues/1","id":118682393,"number":1,"title":"Variants / sum types / tagged unions / discriminated unions / etc.","user":{"login":"sinelaw","id":84020,"avatar_url":"https://avatars.githubusercontent.com/u/84020?v=3","gravatar_id":"","url":"https://api.github.com/users/sinelaw","html_url":"https://github.com/sinelaw","followers_url":"https://api.github.com/users/sinelaw/followers","following_url":"https://api.github.com/users/sinelaw/following{/other_user}","gists_url":"https://api.github.com/users/sinelaw/gists{/gist_id}","starred_url":"https://api.github.com/users/sinelaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinelaw/subscriptions","organizations_url":"https://api.github.com/users/sinelaw/orgs","repos_url":"https://api.github.com/users/sinelaw/repos","events_url":"https://api.github.com/users/sinelaw/events{/privacy}","received_events_url":"https://api.github.com/users/sinelaw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-24T19:13:03Z","updated_at":"2015-11-24T21:31:37Z","closed_at":null,"body":"Maybe github issues are better than wiki pages for discussions?\r\nAnyway, we could make a rule that extensions can always with very small ifdefs get back to standard C *that behaves the same at runtime*.\r\n\r\nSo for variants,\r\n```c\r\nstruct A { }\r\nstruct B { }\r\n\r\nenum Tag { A, B };\r\n\r\nstruct VariantAB {\r\n    union { struct A a; struct B b; } u;\r\n    enum Tag tag;\r\n};\r\n\r\n// elsewhere:\r\nstruct VariantAB x;\r\nswitch (x.tag) {\r\ncase A: // ... use x.u.a\r\n    break;\r\ncase B: // ... use x.u.b\r\n    break;\r\n}\r\n```\r\n\r\nSo far valid standard C. Whatever changes we make should be minor alterations on top of that."},"comment":{"url":"https://api.github.com/repos/cling-lang/spec/issues/comments/159411041","html_url":"https://github.com/cling-lang/spec/issues/1#issuecomment-159411041","issue_url":"https://api.github.com/repos/cling-lang/spec/issues/1","id":159411041,"user":{"login":"da-x","id":321273,"avatar_url":"https://avatars.githubusercontent.com/u/321273?v=3","gravatar_id":"","url":"https://api.github.com/users/da-x","html_url":"https://github.com/da-x","followers_url":"https://api.github.com/users/da-x/followers","following_url":"https://api.github.com/users/da-x/following{/other_user}","gists_url":"https://api.github.com/users/da-x/gists{/gist_id}","starred_url":"https://api.github.com/users/da-x/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/da-x/subscriptions","organizations_url":"https://api.github.com/users/da-x/orgs","repos_url":"https://api.github.com/users/da-x/repos","events_url":"https://api.github.com/users/da-x/events{/privacy}","received_events_url":"https://api.github.com/users/da-x/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T21:31:37Z","updated_at":"2015-11-24T21:31:37Z","body":"BTW I suppose we can have restricted union field access to be made optional with by enabling an additional extension?"}}