smalltalk--backstage--2.2--patch-44
    explain differences between using Dictionary and LookupTable

The meaning of LookupTable's comment -- or its purpose, for that matter
-- was never clear until I read the source, so I expanded it and
Dictionary's as well.

In a twist, the only reason there was such a delay between reading the
comment and reading the source was that gst-base.info made the former so
convenient for me.  Such is the curse of user-friendliness.

-- 
;;; Stephen Compall ** http://scompall.nocandysw.com/blog **
"Peta" is Greek for fifth; a petabyte is 10 to the fifth power, as
well as fifth in line after kilo, mega, giga, and tera.
  -- Lee Gomes, performing every Wednesday in his tech column
     "Portals" on page B1 of The Wall Street Journal
2007-07-11  Stephen Compall  <[EMAIL PROTECTED]>

	* kernel/Dictionary.st: Explain that LookupTable is usually a
	better choice.

	* kernel/LookupTable.st: Expand the explanation of differences
	with Dictionary.


--- orig/kernel/Dictionary.st
+++ mod/kernel/Dictionary.st
@@ -43,7 +43,12 @@
 'I implement a dictionary, which is an object that is indexed by
 unique objects (typcially instances of Symbol), and associates another
 object with that index.  I use the equality operator = to determine
-equality of indices.' !
+equality of indices.
+
+In almost all places where you would use a plain Dictionary, a
+LookupTable would be more efficient; see LookupTable''s comment before
+you use it.  I do have a couple of special features that are useful in
+certain special cases.' !
 
 
 


--- orig/kernel/LookupTable.st
+++ mod/kernel/LookupTable.st
@@ -39,10 +39,11 @@
 !
 
 LookupTable comment:
-'I am similar to Dictionary, except that my representation is
-different (more efficient, but not useful to store a variable
-binding). I use the object equality comparison message #=
-to determine equivalence of indices.' !
+'I am a more efficient variant of Dictionary that cannot be used as a
+pool dictionary of variables, as I don''t use Associations to store
+key-value pairs.  I also cannot have nil as a key; if you need to be
+able to store nil as a key, use Dictionary instead.  I use the object
+equality comparison message #= to determine equivalence of indices.' !
 
 
 !LookupTable class methodsFor: 'instance creation'!



Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to