
On Monday 02 Jan 2006 7:42 pm, Tomasz Zielonka wrote:
On Mon, Jan 02, 2006 at 05:28:39PM +0000, Adrian Hey wrote:
BTW, I think I would prefer the default behaviour of insert to be to retain existing elements because this allows the optimisation of not updating the data structure representing the set at all (which should help keep heap burn rate down).
I hope you don't propose this for Map. It would break some nice uses, like representing variable scopes in an interpreter. The "replacing" insert allows you to easily implement hiding variables in outer scopes.
You mean am I proposing that Maps should retain old association values and discard the new ones? If so the answer is no, of course not. But I see no reason why they shouldn't do this with keys, which are "equal" according to the instance of Ord. (If this is any way dangerous then the key type should not be an instance of Ord IMO.) Regards -- Adrian Hey