{"action":"opened","issue":{"url":"https://api.github.com/repos/fdehau/tui-rs/issues/107","repository_url":"https://api.github.com/repos/fdehau/tui-rs","labels_url":"https://api.github.com/repos/fdehau/tui-rs/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/fdehau/tui-rs/issues/107/comments","events_url":"https://api.github.com/repos/fdehau/tui-rs/issues/107/events","html_url":"https://github.com/fdehau/tui-rs/issues/107","id":395735453,"node_id":"MDU6SXNzdWUzOTU3MzU0NTM=","number":107,"title":"Consider removing generic parameterization on Terminal","user":{"login":"deontologician","id":1366,"node_id":"MDQ6VXNlcjEzNjY=","avatar_url":"https://avatars3.githubusercontent.com/u/1366?v=4","gravatar_id":"","url":"https://api.github.com/users/deontologician","html_url":"https://github.com/deontologician","followers_url":"https://api.github.com/users/deontologician/followers","following_url":"https://api.github.com/users/deontologician/following{/other_user}","gists_url":"https://api.github.com/users/deontologician/gists{/gist_id}","starred_url":"https://api.github.com/users/deontologician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deontologician/subscriptions","organizations_url":"https://api.github.com/users/deontologician/orgs","repos_url":"https://api.github.com/users/deontologician/repos","events_url":"https://api.github.com/users/deontologician/events{/privacy}","received_events_url":"https://api.github.com/users/deontologician/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-03T21:45:49Z","updated_at":"2019-01-03T21:45:49Z","closed_at":null,"author_association":"NONE","body":"So currently, I have a bunch of declarations at the top of my rendering module that look like this:\r\n\r\n```rust\r\ntype StdOut = termion::raw::RawTerminal<std::io::Stdout>;\r\ntype Backend = tui::backend::TermionBackend<StdOut>;\r\ntype Frame<'a> = tui::terminal::Frame<'a, Backend>;\r\ntype Terminal = tui::Terminal<Backend>;\r\n```\r\n\r\nBasically, it seems like the library is over-genericized a bit. Usually, I think adding a generic parameter when it can statically prevent issues the user might encounter. For the case of terminals, it seems like I'm unlikely to instantiate two `Terminal`s each with different backends and then get them confused. (I mean, it's possible, but not probably common).\r\n\r\nThe downside of course is that we need to keep track of all of this stuff. If it's all done within a function boundary, then type inference lets us skip the boilerplate, but if you want to pass a `Terminal` to a function, etc, you either have to specify it all out, or pass the buck and genericize your function.\r\n\r\nWould it be possible to remove some of the generic parameters on the user-facing types like `Frame` and `Terminal`? I realize this is kind of a large task, but it'd significantly improve the ergonomics of the library in my opinion."}}
{"actor":{"display_login":"deontologician"}}