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: Change bytes length notation #714

Closed
jacqueswww opened this issue Mar 22, 2018 · 3 comments
Closed

VIP: Change bytes length notation #714

jacqueswww opened this issue Mar 22, 2018 · 3 comments
Labels
VIP: Approved VIP Approved VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting

Comments

@jacqueswww
Copy link
Contributor

jacqueswww commented Mar 22, 2018

Preamble

VIP: 714
Title: Change bytes length notation
Author: Jacques Wagener
Type: Standard Track
Status: Draft
Created: 2018-03-22

Simple Summary

Change the bytes decleration syntax to resemble a lists' syntax.

Abstract

Change the byte length syntax on declaring a bytearray.

Motivation

The motivation is critical for VIPs that add or change Vyper's functionality. It should clearly explain why the existing Vyper functionality is inadequate to address the problem that the VIP solves as well as how the VIP is in line with Vyper's goals and design philosopy.

Specification

Currently bytearray size are set using the the smaller-than-or-equal operator <=. This VIP will replace it to use the square bracket to indicated the byte size.
From

abytearray: bytes <= 3

To

a: bytes[3]

This makes it slightly more readable and standardised - because list lengths use the same square bracket subscript notation e.g.

alist: int128[7]

Backwards Compatibility

Not backwards compatible. Fully override the old style.

Copyright

Copyright and related rights waived via CC0

@jacqueswww jacqueswww added the VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting label Mar 22, 2018
@DavidKnott DavidKnott mentioned this issue Mar 22, 2018
7 tasks
@fubuloubu
Copy link
Member

I'm on board!

@fubuloubu
Copy link
Member

One thing to consider: mappings

a: bytes[4][address] and b: int128[bytes[3]]

Does that look okay? I think it does

@jacqueswww
Copy link
Contributor Author

@fubuloubu I think it does. But I want this VIP and #564 and to happen before we go beta.

From my side it's the last 2 big changes before, I am happy with the syntax to go beta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VIP: Approved VIP Approved VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting
Projects
None yet
Development

No branches or pull requests

2 participants