{"action":"created","issue":{"url":"https://api.github.com/repos/amethyst/amethyst/issues/1197","repository_url":"https://api.github.com/repos/amethyst/amethyst","labels_url":"https://api.github.com/repos/amethyst/amethyst/issues/1197/labels{/name}","comments_url":"https://api.github.com/repos/amethyst/amethyst/issues/1197/comments","events_url":"https://api.github.com/repos/amethyst/amethyst/issues/1197/events","html_url":"https://github.com/amethyst/amethyst/issues/1197","id":385809460,"node_id":"MDU6SXNzdWUzODU4MDk0NjA=","number":1197,"title":"Figure out a strategy for dealing with generics & default resources","user":{"login":"torkleyy","id":23152057,"node_id":"MDQ6VXNlcjIzMTUyMDU3","avatar_url":"https://avatars1.githubusercontent.com/u/23152057?v=4","gravatar_id":"","url":"https://api.github.com/users/torkleyy","html_url":"https://github.com/torkleyy","followers_url":"https://api.github.com/users/torkleyy/followers","following_url":"https://api.github.com/users/torkleyy/following{/other_user}","gists_url":"https://api.github.com/users/torkleyy/gists{/gist_id}","starred_url":"https://api.github.com/users/torkleyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torkleyy/subscriptions","organizations_url":"https://api.github.com/users/torkleyy/orgs","repos_url":"https://api.github.com/users/torkleyy/repos","events_url":"https://api.github.com/users/torkleyy/events{/privacy}","received_events_url":"https://api.github.com/users/torkleyy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-29T16:08:54Z","updated_at":"2018-11-29T19:50:05Z","closed_at":null,"author_association":"MEMBER","body":"Consider a case where a system `M` accesses a resource `R`. Resource `R` is generic over `G` and implementes `Default`. There's another system `S` which writes into `R`, however it does so with `G = Foo`, while `M` uses `G = Bar`.\r\n\r\n* System `S` -> `R<G = Foo>`\r\n* System `M` <- `R<G = Bar>`\r\n* Resource `R<G>`, `R<G>` implements `Default`\r\n\r\nIf those system get added like this, `M` will try to read from the resource, which, however, only ever has the state given to it by `Default::default`. That means nothing happens and there's no error.\r\n\r\nOne example of this is the usage of `InputHandler<AX, AC>`.\r\n\r\n## Solutions\r\n\r\n### Custom setup handler\r\n\r\nIt's possible to use a custom setup handler for systems reading from the resource that require the resource was added. and warn otherwise. This requires the \"producer system\" to be added before.\r\n\r\n### Implementing a custom `SystemData`\r\n\r\nWe could wrap `ReadExpect` and give additional logging in case the resource is missing.\r\n\r\n### Leaving things as-is\r\n\r\nThis is also a possibility and means this issue can be resolved by documentation."},"comment":{"url":"https://api.github.com/repos/amethyst/amethyst/issues/comments/442969549","html_url":"https://github.com/amethyst/amethyst/issues/1197#issuecomment-442969549","issue_url":"https://api.github.com/repos/amethyst/amethyst/issues/1197","id":442969549,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Mjk2OTU0OQ==","user":{"login":"azriel91","id":2993230,"node_id":"MDQ6VXNlcjI5OTMyMzA=","avatar_url":"https://avatars3.githubusercontent.com/u/2993230?v=4","gravatar_id":"","url":"https://api.github.com/users/azriel91","html_url":"https://github.com/azriel91","followers_url":"https://api.github.com/users/azriel91/followers","following_url":"https://api.github.com/users/azriel91/following{/other_user}","gists_url":"https://api.github.com/users/azriel91/gists{/gist_id}","starred_url":"https://api.github.com/users/azriel91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azriel91/subscriptions","organizations_url":"https://api.github.com/users/azriel91/orgs","repos_url":"https://api.github.com/users/azriel91/repos","events_url":"https://api.github.com/users/azriel91/events{/privacy}","received_events_url":"https://api.github.com/users/azriel91/received_events","type":"User","site_admin":false},"created_at":"2018-11-29T19:50:05Z","updated_at":"2018-11-29T19:50:05Z","author_association":"MEMBER","body":"For the `InputHandler` case, I think `AX` / `AC` shouldn't be constrained to `Default`. There might be other cases where some applications *do* want different `R<G>`s where a default `G` makes sense `=/`. If it's possible to say, \"if there's already a non-default parameter `R<_>`, you must opt-in to have the default `R<G>`\", that would be \"safer\".\r\n\r\n>magic registration of both components and resources\r\nWould you prefer manual registration for both `Component`s and `Resource`s, or does one or the other have a stronger drive?"}}
{"actor":{"display_login":"azriel91"}}