{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/vyper/issues/764","repository_url":"https://api.github.com/repos/ethereum/vyper","labels_url":"https://api.github.com/repos/ethereum/vyper/issues/764/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/vyper/issues/764/comments","events_url":"https://api.github.com/repos/ethereum/vyper/issues/764/events","html_url":"https://github.com/ethereum/vyper/issues/764","id":312055572,"number":764,"title":"VIP: uint256 as a first class citizen","user":{"login":"jacqueswww","id":6917456,"avatar_url":"https://avatars0.githubusercontent.com/u/6917456?v=4","gravatar_id":"","url":"https://api.github.com/users/jacqueswww","html_url":"https://github.com/jacqueswww","followers_url":"https://api.github.com/users/jacqueswww/followers","following_url":"https://api.github.com/users/jacqueswww/following{/other_user}","gists_url":"https://api.github.com/users/jacqueswww/gists{/gist_id}","starred_url":"https://api.github.com/users/jacqueswww/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacqueswww/subscriptions","organizations_url":"https://api.github.com/users/jacqueswww/orgs","repos_url":"https://api.github.com/users/jacqueswww/repos","events_url":"https://api.github.com/users/jacqueswww/events{/privacy}","received_events_url":"https://api.github.com/users/jacqueswww/received_events","type":"User","site_admin":false},"labels":[{"id":751622094,"url":"https://api.github.com/repos/ethereum/vyper/labels/discussion","name":"discussion","color":"000000","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-04-06T17:27:17Z","updated_at":"2018-04-10T03:38:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Preamble\r\n\r\n    VIP: #764\r\n    Title: Uint256 as a first class citizen.\r\n    Author: Jacques Wagener\r\n    Type: Standard Track \r\n    Status: Draft\r\n    Created: 2018-04-06\r\n    Requires (*optional): <VIP number(s)>\r\n    Replaces (*optional): <VIP number(s)>\r\n\r\n\r\n## Simple Summary\r\nAllow generic arithmetic operations to work instead of using specific functions.\r\n\r\n## Abstract\r\nCurrently using uint256 can be very tedious and difficult because all arithmetic has to occur with \r\n\r\n## Motivation\r\n\r\nInitially it was thought that working with unsigned integer are needed and the very large signed integer types could be used and converted. However time, and time again the need for `uint256` to exist as arisen. Using `uint256_*` functions do do any arbitrary calculation becomes a serious issue for readability.\r\n\r\n## Specification\r\n\r\n| function | operator|\r\n| ---------- | ----------- |\r\n| bitwise_and | remains |\r\n| bitwise_or | remains |\r\n| bitwise_xor | remains |\r\n| bitwise_not | remains |\r\n| uint256_add | + |\r\n| uint256_sub | - |\r\n| uint256_mul | * |\r\n| uint256_div | / |\r\n| uint256_exp | ** |\r\n| uint256_mod | % |\r\n| uint256_addmod | remains |\r\n| uint256_mulmod | remains |\r\n| uint256_gt | > |\r\n| uint256_ge | >= |\r\n| uint256_lt | < |\r\n| uint256_le | <= |\r\n| shift | remains |\r\n\r\n*NB* comparison between uint256 and other types should not be implicit. \r\n\r\nIt is important  double check SafeMath is inserted, however working of the functions templates should insert the existing SafeMath behaviour, as seen in:\r\nhttps://github.com/ethereum/vyper/blob/master/vyper/functions/functions.py#L559\r\n\r\nTo be considered:\r\n\r\n```\r\nx: uint256\r\nx += 1\r\n```\r\nshould not be allowed.\r\n\r\n```\r\nx: uint256\r\nx += convert(1, 'uint256')\r\n```\r\nshould be allowed.\r\n\r\n## Backwards Compatibility\r\n\r\nWe can consider keeping `uint256_` functions. But I think removing those functions is best to avoid confusion for new comers.\r\n\r\n## Copyright\r\nCopyright and related rights waived via [CC0](https:s//creativecommons.org/publicdomain/zero/1.0/)"},"comment":{"url":"https://api.github.com/repos/ethereum/vyper/issues/comments/379963885","html_url":"https://github.com/ethereum/vyper/issues/764#issuecomment-379963885","issue_url":"https://api.github.com/repos/ethereum/vyper/issues/764","id":379963885,"user":{"login":"fubuloubu","id":3859395,"avatar_url":"https://avatars3.githubusercontent.com/u/3859395?v=4","gravatar_id":"","url":"https://api.github.com/users/fubuloubu","html_url":"https://github.com/fubuloubu","followers_url":"https://api.github.com/users/fubuloubu/followers","following_url":"https://api.github.com/users/fubuloubu/following{/other_user}","gists_url":"https://api.github.com/users/fubuloubu/gists{/gist_id}","starred_url":"https://api.github.com/users/fubuloubu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fubuloubu/subscriptions","organizations_url":"https://api.github.com/users/fubuloubu/orgs","repos_url":"https://api.github.com/users/fubuloubu/repos","events_url":"https://api.github.com/users/fubuloubu/events{/privacy}","received_events_url":"https://api.github.com/users/fubuloubu/received_events","type":"User","site_admin":false},"created_at":"2018-04-10T03:38:20Z","updated_at":"2018-04-10T03:38:20Z","author_association":"CONTRIBUTOR","body":"I was picturing it more like this: a statement is a collection of literal and non literal members, connected through expressions and operators. On an assignment or assertion expression, there is a clearly identified type on the LHS. The RHS must therefore clearly evaluate it's type to match the LHS. Evaluation of the expression through it's operators must match down to the literal and non literal values that make it up. Since non literals have explicit types, that means it should be clearly defined through the operators what type the matching literal should have. This may become more complex if arbitrary combinations of literals are allowed to take place, but it should still be possible to figure it out if even one node of the AST is a statically typed non-literal value. Corner cases occur when an operator accepts more than one type and implicitly casts, but since we are removing that more generally we shouldn't have to worry as much."}}
{"actor":{"display_login":"fubuloubu"}}