rhaiscript / rhai

Rhai - An embedded scripting language for Rust.
https://crates.io/crates/rhai
Apache License 2.0
3.77k stars 178 forks source link

Willingness to offer alternative Map types behind feature flags? #868

Open bellwether-softworks opened 5 months ago

bellwether-softworks commented 5 months ago

I'm aware of the reasoning for the use of BTreeMap, but find myself in a place where I could benefit greatly from ordered keys. I was curious if there was any potential for offering alternatives (e.g. IndexMap) as opt-in features.

schungx commented 5 months ago

I won't object but then the feature won't be additive... although most of Rhai's flags are non-additive anyway, so that by itself isn't a very big deal.

Another thing to consider is that I would much rather any new Map type to be API-compatible with BTreeMap so that existing code does not need to be modified/rewritten/duplicated. I am not sure about IndexMap, so you can probably try and see how many changes to the existing code base there will be.

I would suggest the feature flag to be called ordered_maps to be consistent with other crates.