![]() ![]() I think this is something that should be done in external libraries, not in the compiler. I have a possible spec in mind (that still requires work), but I didn’t wanna share anything before I understand the history and see whether there is interest in implementing such a thing. A very common use case is to store something for every address that interacts with a contract. But if you mean that they cannot be easily returned from functions, the issue is that mappings can be massive. Well, they’re accessible if you have access to a node and can inspect storage. You can also find a robust implementation of EnumerableMap in OpenZeppelin. There’s even an example of that in the docs: Iterable Mappings. Implementing an iterable mapping is pretty simple. The simple way around it is to store the keys separately if you actually need them. ![]() Mappings are relatively cheap because they’re not implemented as a complicated data structure but instead treat the whole storage as a massive array where collisions are unlikely as long as the keys you calculate are random enough. ![]() This is an inherent limitation of how mappings work. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |