In addition to today's untyped VarDictionary type, we could add Dictionary<K, V> to the library, implementing Godot typed dictionaries.
This would have characteristics similar to Rust's HashMap<K, V>, with both K and V implementing ToVariant + FromVariant. Its API would be largely consistent with the existing Array<T>, notably with three types:
// Typed dictionaries.
struct Dictionary<K, V> {...}
// Untyped dictionaries.
type VarDictionary = Dictionary<Variant, Variant>;
// Type-erased dictionaries (either typed or untyped at runtime).
struct AnyDictionary {...}
Relevant links:
In addition to today's untyped
VarDictionarytype, we could addDictionary<K, V>to the library, implementing Godot typed dictionaries.This would have characteristics similar to Rust's
HashMap<K, V>, with bothKandVimplementingToVariant + FromVariant. Its API would be largely consistent with the existingArray<T>, notably with three types:Relevant links:
DictionaryAPIHashMapAPIArray<T>API