{"action":"opened","issue":{"url":"https://api.github.com/repos/tomaka/vulkano/issues/364","repository_url":"https://api.github.com/repos/tomaka/vulkano","labels_url":"https://api.github.com/repos/tomaka/vulkano/issues/364/labels{/name}","comments_url":"https://api.github.com/repos/tomaka/vulkano/issues/364/comments","events_url":"https://api.github.com/repos/tomaka/vulkano/issues/364/events","html_url":"https://github.com/tomaka/vulkano/issues/364","id":203125220,"number":364,"title":"RFC: Design for objects created at initialization","user":{"login":"tomaka","id":1412254,"avatar_url":"https://avatars.githubusercontent.com/u/1412254?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-25T14:57:31Z","updated_at":"2017-01-25T14:57:31Z","closed_at":null,"body":"This design concerns the second type of objects as described [here](https://github.com/tomaka/vulkano/blob/574b7a7f1a436467daa13f146eea544f40cee2f4/DESIGN.md).\r\n\r\nThese objects are of the form `Foo<D>` where `D` implements a trait named something like `FooDesc`. `D` describes the `Foo`, while `Foo` itself holds the Vulkan equivalent of `D`.\r\n`D` also typically implements various traits like `FooDescExt1` or `FooDescExt2`.\r\n\r\nHere is a reference design to use for these objects: https://is.gd/jkmnrC\r\n\r\nBasically the rules are:\r\n\r\n- `Foo<D>` should implement the same traits as `D` (as long as these traits are related to `Foo`)\r\n- For each extension trait that uses associated types (eg. `FooDescExt1`), add another trait (`FooDescExt1Abstract` in the example) that is automatically implemented on all objects that implement the extension trait, but that can be made into an object.\r\n- Add a \"master\" trait (`FooAbstract` in the example) that requires an implementation of all the extension traits. This master trait must be capable of being made into an object. For extension traits that have a type parameter, require an implementation of `ExtTrait<&TraitObj>`.\r\n- For each extension that has a type parameter (eg. `FooDescExt2`), encourage implementations of this trait to also implement `Trait<&TraitObj>` (eg. `FooDescExt2<&FooDesc>`).\r\n\r\nBy doing so, a `Foo<D>` will always implement both the trait that can be made into an object (`FooAbstract`) and the strongly-typed traits.\r\nAn `Arc<Foo<D>>` can be made into a `Arc<FooAbstract>`, and the `Arc<FooAbstract>` will also implement the strongly-typed traits.\r\n"}}
{"actor":{"display_login":"tomaka"}}