The current implementation of type units feels inconsistent and confusing. I would like to remove them from the language in their current form.
While working on type checking I keep running into issues with units. All of this is made much more difficult because there is very minimal documentation on the subject.
uint256 is considered "unitless", so assignments such as uint256(wei) = uint256 are permitted. It took me a while to realize this was the case, I assumed uint256 was equivalent to uint256(None) and so should not be compatible with uint256(wei).wei_value and uint256(wei), despite both being uint256 with unit wei, are incompatible. timestamp, timedelta, and uint256(sec). Per the documentation, timestamp additionally cannot be added or subtracted with another timestamp. I was unable to check with this firsthand, as attempting to assign to timestamp or timedelta gives me a TypeMistmatch. These feel broken.While I'm not inherently opposed to the idea of units, the current implementation feels more confusing than beneficial. I propose we remove units altogether while refactoring. We can revisit the concept once refactoring is complete and documentation is up-to-date, and hopefully come up with another approach that's cleaner and more consistent.
It's a breaking change.
Copyright and related rights waived via CC0
Meeting notes: discuss with the community, tentatively accepted for now

Most helpful comment