FiniteMap: modifyFM

Simon Peyton-Jones simonpj@microsoft.com
Mon, 17 Jun 2002 09:38:29 +0100


| For my case, it means that the recently allocated new_key=20
| replaces the old key that will have been around longer.=20
| Doesn't this interact badly with generational collectors?=20

I suppose it might, but I doubt its a significant effect, and
the thought of having two versions doesn't appeal much!

| Oh yes, and since the similar operations on Refs and states
| are called modifyBlah, shouldn't the _C versions of
| operations on FiniteMaps be called something with "modify"
| in them?
|=20
| so addToFM_C would become modifyFM
|    addListToFM_C ----"--- listModifyFM
|=20
| etc. I think names with words rather than abbreviations are=20
| easier to read when returning to something after a long=20
| period of absence.

I agree.  Though "addTo" is hardly an abbreviation.

Actually for finite maps etc, we've found "extendFM" to work=20
nicely (better than addTo).  Have a look at the nomenclature
for (say) basicTypes/NameEnv.lhs in GHC's sources.

Changing the names breaks programs, though.

S