Comments (7)
I think the problem with my example is only in function arguments... hmm
from vyper.
Viper assumes maps all have infinite type size; you're right that it's incorrect in that particular case. IMO it's not worth it to have some kind of special-case support for two-item maps.
from vyper.
I agree with you on that, it was a spurious example.
More for my understanding, what is the reasoning behind this decision? A viper contract can store it's own data in maps, which could reach infinite size in theory, but function arguments (or return values) are not allowed to be of variable size. Is this to ensure that gas estimates can be computed, or something more fundamental to the EVM?
I'm still very much learning, excuse my ignorance!
from vyper.
The reason why infinite sized types in general are not allowed as function arguments is indeed gas estimation. The reason why maps specifically are not allowed is that there is no standard for how an entire map can be passed around as a data structure in the ABI, and the code complexity of implementing such a format, as well as the mechanisms for converting between this format and storage maps, is hard.
from vyper.
@vbuterin as a suggestion, can we change that error message to "Maps are not supported for function arguments or outputs"? A much more descriptive error than "has infinite size"
from vyper.
@fubuloubu that's great idea.
from vyper.
Thanks @yograterol. I'll close this one
from vyper.
Related Issues (20)
- multiple eval of `sqrt()` argument
- double eval of the slice start/length args
- incorrect topic logging in raw_log for non-literal expressions
- double eval of raw_args in create_from_blueprint HOT 1
- Disallow `optimize` and `evm-version` `pragma`'s in `.vyi` files
- meta: venom IR roadmap HOT 1
- HashMap index checks when the subscript is folded
- Compilation errors due to not folded convert value
- CompilerPanic for concat on empty(Bytes)
- CodegenPanic for slice on empty(Bytes)
- Mistyped Loop Iterable
- Overriding Storage Allocator Does Not Handle Stateful Modules
- Ambiguous Imports
- Constants Cannot Be Imported From .vyi Files
- External Call Kwargs Allowed for Call to __init__
- Imprecise Duplicate Import Check
- Incorrect error messages during compilation
- overriding allocator does not set global lock position causing crash in codegen HOT 2
- meta: tracker for overriding storage allocator bugs HOT 2
- compiler panic on indexing empty literal arrays
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vyper.