working Edison, a couple of collection modules, and typing troubles

Simon David Foster s.d.f at btinternet.com
Thu May 26 03:28:03 EDT 2005


On Wed, 2005-05-25 at 15:23 -0400, Samuel Bronson wrote:
> Whatever happened to Edison? I want to play with it and the one in the
> HFL cvs repository won't build for me (and uses flat names).
> 
> I was trying my hand at writing some collection classes myself and I
> can't figure out a good typing for map that will let me make Map an
> instance of my Collection class...

In my opinion, if this Collection class is the root class, it is not
general enough, and it is very difficult to get Maps to fit nicely into
such a class. If you look at Java Classpath for example, the Maps are
not instances of Collection, mainly because it is illogical to have an
add function (which just takes an element value) for a Map. I don't like
the tuple method (although I've used it myself) because I don't think it
accurately represents what the element type of a Map is and won't retain
function type backward compatibility (e.g. for insert).

I think what you really need to do is abstract further, layering another
class on top of Collection, and have Collection just contain empty (or
null) and size. This way it applies to any data-structure with multiple
elements and a starting value (e.g. Stacks). Then you can have a class
called say AbstractMap which contains the lookup, addition and deletion
function relevant to Maps, one called AbstractSet which contains set
based operations and so on.

-Si.

-- 
Simon David Foster <s.d.f at btinternet.com>



More information about the Libraries mailing list