{"action":"created","issue":{"url":"https://api.github.com/repos/Morwenn/cpp-sort/issues/28","repository_url":"https://api.github.com/repos/Morwenn/cpp-sort","labels_url":"https://api.github.com/repos/Morwenn/cpp-sort/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/Morwenn/cpp-sort/issues/28/comments","events_url":"https://api.github.com/repos/Morwenn/cpp-sort/issues/28/events","html_url":"https://github.com/Morwenn/cpp-sort/issues/28","id":117600733,"number":28,"title":"Error messages are unreadable","user":{"login":"Morwenn","id":1164683,"avatar_url":"https://avatars.githubusercontent.com/u/1164683?v=3","gravatar_id":"","url":"https://api.github.com/users/Morwenn","html_url":"https://github.com/Morwenn","followers_url":"https://api.github.com/users/Morwenn/followers","following_url":"https://api.github.com/users/Morwenn/following{/other_user}","gists_url":"https://api.github.com/users/Morwenn/gists{/gist_id}","starred_url":"https://api.github.com/users/Morwenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morwenn/subscriptions","organizations_url":"https://api.github.com/users/Morwenn/orgs","repos_url":"https://api.github.com/users/Morwenn/repos","events_url":"https://api.github.com/users/Morwenn/events{/privacy}","received_events_url":"https://api.github.com/users/Morwenn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Morwenn/cpp-sort/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/Morwenn/cpp-sort/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-18T14:41:47Z","updated_at":"2016-05-19T22:33:50Z","closed_at":null,"body":"In its current state, the library produces rather unreadable error messages and can spawn several hundreds of lines of cryptic error messages for a simple missing `const` without a single hint to what may be wrong. Honestly, this is a major drawback and the crazy amount of SFINAE insanity doesn't help.\r\n\r\nWe can't realistically put static assertions all over the place because many mechanisms in the library rely on SFINAE. There may be other ways to handle errors.\r\n\r\n---\r\n\r\nSome elements of answer:\r\n- [x] Use strong `typedef`s via inheritance to define sorters instead of templates aliases.\r\n- [ ] Concepts will probably help to reduce the error madness, but we have to wait for C++17 at least.\r\n- [ ] If the DR allowing to write `using Sorters::operator()...;` makes its way to C++17, it might remove some annoying errors dues to recursion.\r\n- [x] Static assertions could be used after in the sorters' `operator()` to ensure that the iterator category of the parameter is correct. By the time the operator is called, all of the SFINAE checks should already have passed and the only remaining thing before the actual sort is an eventual tag dispatch. Unfortunately, I doubt that it is possible to automate this mechanism.\r\n- [ ] Give a default template parameter to `hybrid_adapter` which would act as a fallback if none of the sorters are picked and trigger an explicit error. Getting the mechanism to work with nested `hybrid_adapter` seems crazy hard though.\r\n- [x] Update the tutorials to stress out the importance of errors to potential sorter writers.\r\n- [x] ~~More static assertions for sorters that only accept copyable types. The error messages when trying to feed a collection of move-only types to a sorter that needs to copy them are not really readable~~ (solved by #15, all sorters now work with move-only types).\r\n\r\nTo be honest the errors occuring when a `const` is missing are the worst kind. There might be ways to require less `const` everywhere while still providing it when needed."},"comment":{"url":"https://api.github.com/repos/Morwenn/cpp-sort/issues/comments/220470815","html_url":"https://github.com/Morwenn/cpp-sort/issues/28#issuecomment-220470815","issue_url":"https://api.github.com/repos/Morwenn/cpp-sort/issues/28","id":220470815,"user":{"login":"Morwenn","id":1164683,"avatar_url":"https://avatars.githubusercontent.com/u/1164683?v=3","gravatar_id":"","url":"https://api.github.com/users/Morwenn","html_url":"https://github.com/Morwenn","followers_url":"https://api.github.com/users/Morwenn/followers","following_url":"https://api.github.com/users/Morwenn/following{/other_user}","gists_url":"https://api.github.com/users/Morwenn/gists{/gist_id}","starred_url":"https://api.github.com/users/Morwenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Morwenn/subscriptions","organizations_url":"https://api.github.com/users/Morwenn/orgs","repos_url":"https://api.github.com/users/Morwenn/repos","events_url":"https://api.github.com/users/Morwenn/events{/privacy}","received_events_url":"https://api.github.com/users/Morwenn/received_events","type":"User","site_admin":false},"created_at":"2016-05-19T22:33:50Z","updated_at":"2016-05-19T22:33:50Z","body":"Apparently, [some tricks exist][1] to display better error messages upon SFINAE failure. I can probably check whether some of them could be used to improve **cpp-sort**'s error messages too.\r\n\r\n\r\n  [1]: https://github.com/SuperV1234/cppnow2016/blob/master/trip_report.md#inline-static-error"}}
{"actor":{"display_login":"Morwenn"}}