Stupid question 
Author Message
 Stupid question


Quote:



> > I suppose not using nil as key in LookupTable is "by design" thing. Does
> > anybody know about realization LookupTable in other dialects?

> VAST uses two arrays to implement LookupTable. The presence of nil in a
slot
> in the key table indicates 'no object present'. Therefore it does not
allow
> nil as a key to a LookupTable entry. VAST does allow nil as a key in a
> Dictionary.

In QKS Smalltalk (91-98), and in SmallScript the <Map> class and its
numerous derivatives that include <Dictionary> are all implemented for
efficiency using an array of pair'ed (or arbitrarily tupled slots for
multi-key versions) slots (not Associations).

They allow any object to be stored within them, including <nil>. The
technique is to allocate a unique object that serves as the VOID_KEY. If an
entry contains the VOID_KEY then it is clear. Which means that the VOID_KEY
is the only object which cannot be contained within such a collection.
However the VOID_KEY is a private shared-variable within <KeyedCollection>
and would not (in a sensible way) be accessible. The use of <nil> as a key
can be crucial in a variety of applications.

Recent benchmarks on c.l.s. within the last 9-MOS or so seemed to indicate
that SmallScript's implementation was the fastest map/dictionary collection
available for any Smalltalk.

I.e., <Dictionary> within SmallScript, is what these other Smalltalks call
<LookupTable>. AssociationDictionary is the map/dictionary class built from
Associations. The core SmallScript library/module does not provide an
Association or AssociationDictionary; they are in the ANSI.Smalltalk
library. A significicantly richer enhancement to associations is used for
<Pool> namespace variable collections and their related <PoolVariable>
classes.

<Map> provides a synthetic association interface if needed. During the ANSI
process the general concensus was that use of Associations was innefficient
and should be deprecated within ANSI libraries for standard Map/Dictionary
forms.

-- Dave S. [www.smallscript.org]

Quote:

> Doug Swartz




Sun, 18 Jul 2004 04:25:17 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Seemingly Stupid Question

2. Stupid Question 101

3. Really stupid question

4. Stupid question...Is sed in gawk??

5. Really stupid question...

6. Stupid questions from awk novice

7. 2 VERY stupid questions: globals & rnd

8. Stupid Question

9. Beginner with another stupid question?

10. Creating A Spin Control - A Stupid Question

11. ListBox control stupid questions

12. Stupid question

 

 
Powered by phpBB® Forum Software