space efficiency question

Simon Peyton-Jones [email protected]
Mon, 17 Dec 2001 01:24:47 -0800


This is a multi-part message in MIME format.

--------------InterScan_NT_MIME_Boundary
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C186DC.ABC0BECE"

------_=_NextPart_001_01C186DC.ABC0BECE
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Now: if I have a couple of thousand of these Instances, created with the
same Attributes value, as in:

=20
a =3D Attributes ["a","bc"]
i0000 =3D Instance a [1,2]
i0001 =3D Instance a [1,1]
...
i7896 =3D Instance a [2,1]
=20
can I be assured that there are not thousands of actual copies of a but
that they simply have a pointer to a ? I'm interested in the answer for
both ghc (compiled/interpreted) as interpreted Hugs.=20

Yes for GHC: you'll only get one copy of 'a'.
=20
Simon
=20

------_=_NextPart_001_01C186DC.ABC0BECE
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Now: if I have a couple of thousand of =
these=20
Instances, created with the same Attributes value, as in:</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>a =3D Attributes =
["a","bc"]</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>i0000 =3D Instance a =
[1,2]</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>i0001 =3D Instance a =
[1,1]</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>i7896 =3D Instance a =
[2,1]</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial><FONT size=3D2>can I be assured that there are =
not=20
  thousands of actual copies of a but that they simply have a pointer to =
a ? I'm=20
  interested in the answer for both ghc (compiled/interpreted) as =
interpreted=20
  Hugs.<SPAN class=3D268132109-17122001><FONT=20
  color=3D#0000ff>&nbsp;</FONT></SPAN></FONT></FONT></DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial><FONT size=3D2><SPAN =
class=3D268132109-17122001><FONT=20
color=3D#0000ff>Yes for GHC: you'll only get one copy of=20
'a'.</FONT></SPAN></FONT></FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial><FONT size=3D2><SPAN=20
class=3D268132109-17122001></SPAN></FONT></FONT>&nbsp;</DIV>
<DIV dir=3Dltr><FONT face=3DArial><FONT size=3D2><SPAN =
class=3D268132109-17122001><FONT=20
color=3D#0000ff>Simon</FONT></SPAN></FONT></FONT></DIV>
<DIV dir=3Dltr><FONT face=3DArial><FONT size=3D2><SPAN=20
class=3D268132109-17122001>&nbsp;</SPAN></FONT></FONT></DIV></BODY></HTML=
>

------_=_NextPart_001_01C186DC.ABC0BECE--

--------------InterScan_NT_MIME_Boundary--