Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

752 custom units #778

Merged
merged 3 commits into from
Apr 30, 2018
Merged

752 custom units #778

merged 3 commits into from
Apr 30, 2018

Conversation

jacqueswww
Copy link
Contributor

@jacqueswww jacqueswww commented Apr 16, 2018

- What I did

Implements #752, custom units.

- How I did it

Added support for units as a custom global keyword.

# specify units used in the contract.
units: {
    cm: "centimeter",
    km: "kilometer"
}

# global storage
a: int128(cm)


@public
def test() -> int128(km):
    b: int128(km)
    b = 100
    return b

- How to verify it

See tests and exceptions in parser.py

- Description for the changelog

- Cute Animal Picture

@fubuloubu
Copy link
Member

Later on down the line, I wonder if we could define conversion tables for units like this, where a numeric conversion exists between different units (e.g. ether)

@jacqueswww jacqueswww force-pushed the master branch 6 times, most recently from 5c0cb13 to 89bac65 Compare April 19, 2018 23:54
@jacqueswww jacqueswww merged commit 3241864 into vyperlang:master Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants