Lists/Maps/Sets (Was Re: The story of E, part 2 (fwd))
Mark S. Miller
markm@erights.org
Wed, 14 Oct 1998 16:50:19 -0700
At 10:05 PM 10/11/98 -0700, Ka-Ping Yee wrote:
>First, personal opinions about the individual names...
>
>I have to say "TableEditor" sounds particularly awful to me;
It sucks.
> | mapping sequence
> -----------+------------------------------
> immutable | table tuple
> |
> mutable | dictionary list
>
> | ******** sequence
> -----------+------------------------------
> immutable | mapping tuple
> |
> mutable | dictionary list
> | mapping tuple
> -----------+------------------------------
> immutable | mapping tuple
> |
> mutable | dictionary list
Here are the Java-imposed naming constraints:
* Java already has a "Dictionary", and it has a different contract
(guaranteed not to admit nulls as keys or values), so I can't reuse that term.
* Java already has a well known mutable sequence type, unfortunately called
Vector, whose contract is compatible with my needs.
* Java has used up "Array" for a contract that is element-mutable but not
length-mutable.
Here are the MarkM-esthetics-imposed constraints:
* The items on the immutable row correspond to mathematical objects, as
might be taught in a course on set theory. They should have names
suggestive of their math-value nature, which is why I like "Mapping" better
than "Table" for the immutable first-column thingo.
* Even though none of your suggested matrices have "Table" as the
first-column label, I didn't catch an argument against it.
* There remains the issue of what call a mutable first-column thingo.
While cute, I don't want to re-use Xanadu's choice of "MuTable".
Putting these together, we've got
Table Sequence
----+----------------------------
immutable | Mapping Tuple
|
mutable | ??????? Vector
For the missing one, I'm at a loss. Suggestions solicited. Consider
coming up with terms for "snapshot"/"newMutable" at the same time.
If a generalizable naming pattern can be found that generalizes to other
such column-triples, I'd be willing to waive many of the above constraints.
The memorability of a reusable naming pattern is worth a lot, and the same
three-way distinction keeps coming up elsewhere (eg, Slot, FinalSlot,
SettableSlot).