Questions about sharing

D. Tweed
Fri, 7 Dec 2001 14:27:10 +0000 (GMT)

On Fri, 7 Dec 2001, Adrian Hey wrote:

> The first is..
> Does the compiler keep a unique copy of expressions which consist of just
> a single zero arity constructor (eg. [],True,Nothing..) as a CAF which is
> referenced each time the constructor appears in an expression, or does it
> duplicate the constructor (expression) each time it's used.
> Maybe I should define my own CAF at the top level and use it instead?
> (or perhaps they're unboxed somehow?)

Really idle curiosity... why would having a single copy of a zero arity
constructor be more efficient than have multiple copies? Wouldn't they fit
into a `cell' which wouldn't be larger than the one that would
(IIRC) be used for the indirection to the CAF? (I can understand a larger
CAF being a win, but one this small?)

___cheers,_dave_________________________________________________________|`...heat generated by its microprocessors will|slope upward exponentially, reaching the power
work tel:(0117) 954-5250 |density of a nuclear reactor before 2010'-Intel