[comp.lang.smalltalk] Smalltalk dictionary implementation

hubert@cs.uni-sb.de (Hubert Baumeister) (06/19/91)

In article <1991Jun19.154629.10217@phillip.edu.au>, x01233@phillip.edu.au writes:
|> 
|> I am curious as to how Smalltalk implements dictionaries. From an examination
|> of the code it seems that an insertion into a full dictionary results in the
|> entire dictionary being copied (and increased in size) with the new item being
|> inserted as the last act.
|> 
|> Is this right, or have I been staring at the screen for too long?

That is right.

|> As well is there any way to specify an initial size for a dictionary
|> (a variant on the 'new' message)?

Yes. Try Dictionary new: size. This will create a dictionary which is capable
of holding about size elements without growing.

Hubert

-- 
					Hubert Baumeister
					Max-Planck-Institut f"ur Informatik
					Im Stadtwald
					6600 Saarbr"ucken

					Telefon: (x49-681)302-5432
					e-mail: hubert@cs.uni-sb.de

x01233@phillip.edu.au (06/20/91)

I am curious as to how Smalltalk implements dictionaries. From an examination
of the code it seems that an insertion into a full dictionary results in the
entire dictionary being copied (and increased in size) with the new item being
inserted as the last act.

Is this right, or have I been staring at the screen for too long?

As well is there any way to specify an initial size for a dictionary
(a variant on the 'new' message)?


Thanks...


-------------------------------------------------------------------------------
Dale Stanbrough         | 
dale@phillip.edu.au     |
Melbourne, Australia    |