Can someone who knows macros better tell me if this is a workable idea or not:

Would it be possible to make a macro that builds an associative array trait object (which could default to Hashmap as the implementation type) which works like the following:

let d1 = dict!("key"=>"Value"); // type is trait object AssociativeArray let d2 = dict!(std::collections::HashMap,"key"=>"Value"); // type is std::collections::HashMap let d3:std::collections::BTreeMap<_,_> = dict!("key" => "Value"); // type is std::collections::BTreeMap let d4 = dict!(d1,"key"=>"NewValue"); // takes ownership of d1, inserts keys into AssociativeArray

Maybe the skip the last one. I'm not sure.

This suggestion would preclude the introduction of a such a trait, which, given its absence, maybe there's a good reason for not having and therefore this entire suggestion is moot?