Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
Otoh, the generation counter is only necessary for a cache inside ShadowedMapping. I think it'd work pretty well without that cache too, so imo it's not worth the overhead in all mappings. Is there something else to motivate having built-in generation counters?
The cache is needed for keeping indices() and values() stable.
My gut feeling is that this is going overboard. I see limited use. You could, use it is a debugging aid, but even then the value is questionable.
I'd prefer not to extend the language with this overhead.
Since the consensus seems to be against having generation counters, I've just removed the implementation.
The main use case (monitoring an external mapping) can be done by utilizing deferred copy and equal() albeit at a minor performance loss:
* The copy will be realized at first edit.
* equal() is an expensive operation if the compared mappings are substantially similar but not the same (ie one is a deep copy of the other), but this is probably unlikely in practise.
-- Sincerely, Stephen R. van den Berg.