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

VIP: Remove required keyword arguments from builtin functions #1879

Closed
iamdefinitelyahuman opened this issue Mar 7, 2020 · 5 comments · Fixed by #1892
Closed

VIP: Remove required keyword arguments from builtin functions #1879

iamdefinitelyahuman opened this issue Mar 7, 2020 · 5 comments · Fixed by #1892
Labels
VIP: Approved VIP Approved

Comments

@iamdefinitelyahuman
Copy link
Contributor

Simple Summary

Vyper should not use required keyword arguments in built-in functions.

  1. raw_call requires outsize and gas as keyword args.
  2. slice requires start and len as keyword args.

Motivation

Given the similarity to between Vyper syntax and Python syntax, the current style is unintuitive to write and misleading to read. I believe keyword arguments should only be used for optional fields. All required arguments should always be positional.

Specification

  1. For raw_call, convert outsize and gas to positional arguments.
    a. Alternatively, gas could become an optional argument that defaults to gasLeft.
  2. For slice, convert start and len to positional arguments.
# current
raw_call(_addr, b"moose", outsize=7, gas=50000)
slice(inp1, start=3, len=3)


# proposed
raw_call(_addr, b"moose", 7, 50000)
slice(inp1, 3, 3)

Backwards Compatibility

This is a breaking change, but it will only require slight modifications to existing contracts.

Copyright

Copyright and related rights waived via CC0

@iamdefinitelyahuman
Copy link
Contributor Author

I might have missed some builtins, will update this VIP if I encounter any others.

@fubuloubu
Copy link
Member

Alternatively, gas could become an optional argument that defaults to gasLeft

This would be what I prefer

@fubuloubu fubuloubu mentioned this issue Mar 16, 2020
8 tasks
@charles-cooper
Copy link
Member

Alternatively, gas could become an optional argument that defaults to gasLeft

I like this but it should be a different VIP

@charles-cooper
Copy link
Member

charles-cooper commented Mar 16, 2020

slice requires start and len as keyword args.

nice to have: just use python slice syntax (but should also be new VIP)

@fubuloubu
Copy link
Member

Update this VIP to talk just about slice. All conversation from meeting about raw_call is moved to #1890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VIP: Approved VIP Approved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants