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

[WIT] Defining a HashMap #390

Closed
yordis opened this issue Aug 26, 2024 · 3 comments
Closed

[WIT] Defining a HashMap #390

yordis opened this issue Aug 26, 2024 · 3 comments

Comments

@yordis
Copy link

yordis commented Aug 26, 2024

I am currently working on a protobuf plugin to convert protobuf into WIT.

I wonder if there is a way to define a hashmap/map/dictionary that would allow me to do something similar to map<uint32, bool> map_uint32_bool = 96; in protobuf.

Is this in the roadmap, or should I use map_uint32_bool: list<tuple<string, bool>> for this case?

Ideally, I would have a map type for this; it is commonly expected nowadays I feel.

@lukewagner
Copy link
Member

Yes, for right now, list<tuple<string, bool>> is the way to go. There is #125 filed already to add a first-class map<K,V> or dict<V> type (the latter fixing the key type to string). I increasingly think this would be quite valuable for many languages, so I think it's a good idea and just a matter of time/prioritization. The main reason for not doing it yet is that there are some tricky design questions (listed in #125), although I expect we can find some workable compromises.

@lukewagner
Copy link
Member

(Also: exciting to hear about your protobuf/WIT converter!)

@yordis
Copy link
Author

yordis commented Aug 26, 2024

Closing in favor of #125

@yordis yordis closed this as completed Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants