{"action":"created","issue":{"url":"https://api.github.com/repos/TokTok/toxcore/issues/8","repository_url":"https://api.github.com/repos/TokTok/toxcore","labels_url":"https://api.github.com/repos/TokTok/toxcore/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/TokTok/toxcore/issues/8/comments","events_url":"https://api.github.com/repos/TokTok/toxcore/issues/8/events","html_url":"https://github.com/TokTok/toxcore/issues/8","id":164688737,"number":8,"title":"Toxcore should make more liberal use of assertions","user":{"login":"iphydf","id":10647936,"avatar_url":"https://avatars.githubusercontent.com/u/10647936?v=3","gravatar_id":"","url":"https://api.github.com/users/iphydf","html_url":"https://github.com/iphydf","followers_url":"https://api.github.com/users/iphydf/followers","following_url":"https://api.github.com/users/iphydf/following{/other_user}","gists_url":"https://api.github.com/users/iphydf/gists{/gist_id}","starred_url":"https://api.github.com/users/iphydf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iphydf/subscriptions","organizations_url":"https://api.github.com/users/iphydf/orgs","repos_url":"https://api.github.com/users/iphydf/repos","events_url":"https://api.github.com/users/iphydf/events{/privacy}","received_events_url":"https://api.github.com/users/iphydf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"GrayHatter","id":243408,"avatar_url":"https://avatars.githubusercontent.com/u/243408?v=3","gravatar_id":"","url":"https://api.github.com/users/GrayHatter","html_url":"https://github.com/GrayHatter","followers_url":"https://api.github.com/users/GrayHatter/followers","following_url":"https://api.github.com/users/GrayHatter/following{/other_user}","gists_url":"https://api.github.com/users/GrayHatter/gists{/gist_id}","starred_url":"https://api.github.com/users/GrayHatter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrayHatter/subscriptions","organizations_url":"https://api.github.com/users/GrayHatter/orgs","repos_url":"https://api.github.com/users/GrayHatter/repos","events_url":"https://api.github.com/users/GrayHatter/events{/privacy}","received_events_url":"https://api.github.com/users/GrayHatter/received_events","type":"User","site_admin":false},"assignees":[{"login":"GrayHatter","id":243408,"avatar_url":"https://avatars.githubusercontent.com/u/243408?v=3","gravatar_id":"","url":"https://api.github.com/users/GrayHatter","html_url":"https://github.com/GrayHatter","followers_url":"https://api.github.com/users/GrayHatter/followers","following_url":"https://api.github.com/users/GrayHatter/following{/other_user}","gists_url":"https://api.github.com/users/GrayHatter/gists{/gist_id}","starred_url":"https://api.github.com/users/GrayHatter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrayHatter/subscriptions","organizations_url":"https://api.github.com/users/GrayHatter/orgs","repos_url":"https://api.github.com/users/GrayHatter/repos","events_url":"https://api.github.com/users/GrayHatter/events{/privacy}","received_events_url":"https://api.github.com/users/GrayHatter/received_events","type":"User","site_admin":false},{"login":"JFreegman","id":1646057,"avatar_url":"https://avatars.githubusercontent.com/u/1646057?v=3","gravatar_id":"","url":"https://api.github.com/users/JFreegman","html_url":"https://github.com/JFreegman","followers_url":"https://api.github.com/users/JFreegman/followers","following_url":"https://api.github.com/users/JFreegman/following{/other_user}","gists_url":"https://api.github.com/users/JFreegman/gists{/gist_id}","starred_url":"https://api.github.com/users/JFreegman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JFreegman/subscriptions","organizations_url":"https://api.github.com/users/JFreegman/orgs","repos_url":"https://api.github.com/users/JFreegman/repos","events_url":"https://api.github.com/users/JFreegman/events{/privacy}","received_events_url":"https://api.github.com/users/JFreegman/received_events","type":"User","site_admin":false},{"login":"nurupo","id":1855294,"avatar_url":"https://avatars.githubusercontent.com/u/1855294?v=3","gravatar_id":"","url":"https://api.github.com/users/nurupo","html_url":"https://github.com/nurupo","followers_url":"https://api.github.com/users/nurupo/followers","following_url":"https://api.github.com/users/nurupo/following{/other_user}","gists_url":"https://api.github.com/users/nurupo/gists{/gist_id}","starred_url":"https://api.github.com/users/nurupo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nurupo/subscriptions","organizations_url":"https://api.github.com/users/nurupo/orgs","repos_url":"https://api.github.com/users/nurupo/repos","events_url":"https://api.github.com/users/nurupo/events{/privacy}","received_events_url":"https://api.github.com/users/nurupo/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-07-09T22:29:55Z","updated_at":"2016-07-11T08:52:57Z","closed_at":null,"body":"@JFreegman mentioned an [article](http://blog.regehr.org/archives/1091) about assertions that contains some useful thoughts on how to write good assertions and what to pay attention to.\r\n\r\nAs discussed in #5, artificially restricting the interface of a function to include sanity checks about layers on top of it is not ideal, since it breaks module abstractions. Also, swallowing severe code errors tends to hide bugs that could go unnoticed for some time.\r\n\r\nTherefore, I would suggest we make a gradual move towards having our APIs accept their whole function domain and encoding bug-checking checks with knowledge of higher layers as assertions.\r\n\r\nFor a specific first case and its discussion, see #5."},"comment":{"url":"https://api.github.com/repos/TokTok/toxcore/issues/comments/231677224","html_url":"https://github.com/TokTok/toxcore/issues/8#issuecomment-231677224","issue_url":"https://api.github.com/repos/TokTok/toxcore/issues/8","id":231677224,"user":{"login":"neduard","id":666148,"avatar_url":"https://avatars.githubusercontent.com/u/666148?v=3","gravatar_id":"","url":"https://api.github.com/users/neduard","html_url":"https://github.com/neduard","followers_url":"https://api.github.com/users/neduard/followers","following_url":"https://api.github.com/users/neduard/following{/other_user}","gists_url":"https://api.github.com/users/neduard/gists{/gist_id}","starred_url":"https://api.github.com/users/neduard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neduard/subscriptions","organizations_url":"https://api.github.com/users/neduard/orgs","repos_url":"https://api.github.com/users/neduard/repos","events_url":"https://api.github.com/users/neduard/events{/privacy}","received_events_url":"https://api.github.com/users/neduard/received_events","type":"User","site_admin":false},"created_at":"2016-07-11T08:52:57Z","updated_at":"2016-07-11T08:52:57Z","body":"I am in strong favour of having as many asserts as possible, but used as mentioned in the article by John Regehr. In the section \"Where Do Assertions Come From?\" it is said they exist specifically to denote:\r\n* pre conditions\r\n* post conditions\r\n* invariants\r\n* *spec*\r\nThe benefit is that if there are many assertions, static analysers could be used at a later stage and start discharging them. Alternatively, the asserts could be used as a basis to start adding contracts in the source code. These can be enforced by static checkers such as frama-c / tis-interpreter. There will be no need to enable them in production as we will have a guarantee that those asserts will never be tripped and thus no performance penalty (they might even speed up execution as the `if` statements become shorter)."}}
{"actor":{"display_login":"neduard"}}