On first glance using @ makes a lot of sense here. But if there would be any syntax with @ I’d like it to be the following instead:
consume(&HashMap::new().@m {
m.insert("key1", val1);
m.insert("key2", val2);
m
};
However, in this case we should make m mutable as well because it would be surprising to have @ behaving differently in this context than in patterns:
consume(&HashMap::new().@mut m {
m.insert("key1", val1);
m.insert("key2", val2);
m
};
Well, and this should be scaled on simple use cases:
let result = client.get("url")
.@mut q { await q.send()? }
.@mut r { await r.json()? };
Just compare it with original example:
let result = client.get("url")
.[await send()]?
.[await json()]?;
And with syntax you propose:
let result = client.get("url")
.{ mut q@ await q.send() }?
.{ mut r@ await r.json() }?;
So, this as well as any other explicit receiver syntax don’t really makes things simpler IMO. We anyway would need to explain users how .{} works, how @ works, how it’s different from pattern context, how to use this syntax to not grow code horizontally, etc.
And Rust already has reputation of extremely verbose language. Do we need to make it yet worse?