-
-
Notifications
You must be signed in to change notification settings - Fork 793
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
Custom constants of lists #1211
Comments
Hmmm I don't think we ever considered lists to be constants, not that could not be - just that it never was considered. |
Looks like the use case here is for an "empty list" or a list full of empty entries. @nrryuya are you looking for a way to assert that a list has not been set yet? |
Well it's not the only use case, I can easily imagine something like a making sure you have set of values like: VALID_STATES: constant(int128) = [1, 33, 44, 55 .. ] Or another form of storing owners? OWNERS: constant(address[3]) = [....] Just thinking out loud - on what it could be used for. |
Case 1 would actually be better served by enums (which we don't have... yet). Basically something like: enum(int128) State:
A = 1
B = 33
C = 44
D = 55 Case 2 is typically done dynamically through a constructor. Probably not the best idea to hardcode a collection of addresses, since they might change on every deployment and you would have to update the code, but I can see a limited rationale of how that could be useful for something like templated programs (but basically, just use constructor args) |
Yep. I found this issue when I wanted to return a list full of I'm also not confident about the use case of this feature...
|
List of primes might be a good one! |
Version Information
What's your issue about?
I'm not sure whether this is designed or a bug but Vyper doesn't support custom constants of lists.
It'd be better to support it if there is no concern?
Cute Animal Picture
The text was updated successfully, but these errors were encountered: