Skip to content

VIP: Remove required keyword arguments from builtin functions #1879

@iamdefinitelyahuman

Description

@iamdefinitelyahuman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions