Dealing with configuration data
Andrew J Bromage
ajb@spamcop.net
Sun, 29 Sep 2002 11:00:28 +1000
G'day all.
On Fri, Sep 27, 2002 at 12:56:38PM -0400, Dean Herington wrote:
> I'm not sure why you consider the code you refer to above so ugly.
Anything which relies on unsafePerformIO (or seq, for that matter)
is ugly. Personal opinion, of course. :-)
> Question:
> Why do you use `seq` on `globalTableRef`?
Good question. It's actually a form of documentation. I wasn't 100%
sure how concurrency and CAFs interact at the time (and I'm still
not), so I left that in as a sort of note to myself to check this out.
Admittedly a comment would have been clearer. :-)
> You use `addToFM` to replace entries in your table. Without additional
> logic to increase strictness, I think you unnecessarily risk stack
> overflow.
That's true, although the case of many writes followed by a single
read I would expect to be rare in practice. Besides, IOGlobal is not
designed for performance. It's designed for quick hacks.
Cheers,
Andrew Bromage