|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.dtl - MinTL interfaces/classes for containers
A couple of people have brought up interfaces and classes for containers ala Java's container hierarchy. I was thinking of having 4 interfaces Collection, ISimpleList, IList and IAssocArray. Collection is the root interface and is roughly going to be like Java's Collection. The IList will have several class implementations backed by doubly-linked lists (circular and non-circular) and array lists (which will have a ctor that takes a dynamic array). The ISimpleList will have fewer members and covers singly-linked lists and heaps. The IAssocArray will have three implementations backed by a builtin AA, a sorted AA and a linked AA. I was thinking of naming the classes things like OList, OArrayList, OCList, OLinkedAA, OAssocArray, OSortedAA, etc. The idea behind the "O" prefix is that the struct forms in MinTL use the "raw" name like List, ArrayList, SortedAA, etc and so some other name is needed to indicate the object form. Using "I" as a prefix for interfaces is pretty common so that seems ok. But the "O" seems odd. Any suggestions for either the naming scheme or the classes in general? -Ben Apr 27 2005
I'd prefer C over O... (C for Class), since it looks nicer. Also, I hope that your ConcurrentAA would also implement the interface. It's got my vote! Let me know if you want any help. I'd like to start using interfaces like this immediately. John Demme On Wed, 2005-04-27 at 22:08 -0400, Ben Hinkle wrote:A couple of people have brought up interfaces and classes for containers ala Java's container hierarchy. I was thinking of having 4 interfaces Collection, ISimpleList, IList and IAssocArray. Collection is the root interface and is roughly going to be like Java's Collection. The IList will have several class implementations backed by doubly-linked lists (circular and non-circular) and array lists (which will have a ctor that takes a dynamic array). The ISimpleList will have fewer members and covers singly-linked lists and heaps. The IAssocArray will have three implementations backed by a builtin AA, a sorted AA and a linked AA. I was thinking of naming the classes things like OList, OArrayList, OCList, OLinkedAA, OAssocArray, OSortedAA, etc. The idea behind the "O" prefix is that the struct forms in MinTL use the "raw" name like List, ArrayList, SortedAA, etc and so some other name is needed to indicate the object form. Using "I" as a prefix for interfaces is pretty common so that seems ok. But the "O" seems odd. Any suggestions for either the naming scheme or the classes in general? -Ben Apr 27 2005
The downside of C for Class is that I'm using CList to mean "circular list". At the time I made that name I actually kept confusing it with C for Class so I think the thing to do is just rename the circular list to something like oh.. CircularList. I remember I almost called it Ring but I would prefer to keep the word List in the name. For anyone using the current CList ... sorry! (good thing D is still so young it doesn't hurt to shift stuff around). So I like the idea of using C for Class. The Concurrent classes might be harder to plug into the same interfaces as the non-concurrent containers since concurrency tends to impose extra restrictions on behavior. I'll check it out, though. It shouldn't be too hard to get it to fit. "John Demme" <me teqdruid.com> wrote in message news:1114656516.1363.7.camel localhost.localdomain...I'd prefer C over O... (C for Class), since it looks nicer. Also, I hope that your ConcurrentAA would also implement the interface. It's got my vote! Let me know if you want any help. I'd like to start using interfaces like this immediately. John Demme On Wed, 2005-04-27 at 22:08 -0400, Ben Hinkle wrote:A couple of people have brought up interfaces and classes for containers ala Java's container hierarchy. I was thinking of having 4 interfaces Collection, ISimpleList, IList and IAssocArray. Collection is the root interface and is roughly going to be like Java's Collection. The IList will have several class implementations backed by doubly-linked lists (circular and non-circular) and array lists (which will have a ctor that takes a dynamic array). The ISimpleList will have fewer members and covers singly-linked lists and heaps. The IAssocArray will have three implementations backed by a builtin AA, a sorted AA and a linked AA. I was thinking of naming the classes things like OList, OArrayList, OCList, OLinkedAA, OAssocArray, OSortedAA, etc. The idea behind the "O" prefix is that the struct forms in MinTL use the "raw" name like List, ArrayList, SortedAA, etc and so some other name is needed to indicate the object form. Using "I" as a prefix for interfaces is pretty common so that seems ok. But the "O" seems odd. Any suggestions for either the naming scheme or the classes in general? -Ben Apr 27 2005
Isn't using I and C or O as prefixes for interfaces and clases hungarian notaion? IIRC, the D Style asks us to Just Say No to hungarian notation. Ben Hinkle wrote:The downside of C for Class is that I'm using CList to mean "circular list". At the time I made that name I actually kept confusing it with C for Class so I think the thing to do is just rename the circular list to something like oh.. CircularList. I remember I almost called it Ring but I would prefer to keep the word List in the name. For anyone using the current CList ... sorry! (good thing D is still so young it doesn't hurt to shift stuff around). So I like the idea of using C for Class. The Concurrent classes might be harder to plug into the same interfaces as the non-concurrent containers since concurrency tends to impose extra restrictions on behavior. I'll check it out, though. It shouldn't be too hard to get it to fit. "John Demme" <me teqdruid.com> wrote in message news:1114656516.1363.7.camel localhost.localdomain...I'd prefer C over O... (C for Class), since it looks nicer. Also, I hope that your ConcurrentAA would also implement the interface. It's got my vote! Let me know if you want any help. I'd like to start using interfaces like this immediately. John Demme On Wed, 2005-04-27 at 22:08 -0400, Ben Hinkle wrote:A couple of people have brought up interfaces and classes for containers ala Java's container hierarchy. I was thinking of having 4 interfaces Collection, ISimpleList, IList and IAssocArray. Collection is the root interface and is roughly going to be like Java's Collection. The IList will have several class implementations backed by doubly-linked lists (circular and non-circular) and array lists (which will have a ctor that takes a dynamic array). The ISimpleList will have fewer members and covers singly-linked lists and heaps. The IAssocArray will have three implementations backed by a builtin AA, a sorted AA and a linked AA. I was thinking of naming the classes things like OList, OArrayList, OCList, OLinkedAA, OAssocArray, OSortedAA, etc. The idea behind the "O" prefix is that the struct forms in MinTL use the "raw" name like List, ArrayList, SortedAA, etc and so some other name is needed to indicate the object form. Using "I" as a prefix for interfaces is pretty common so that seems ok. But the "O" seems odd. Any suggestions for either the naming scheme or the classes in general? -Ben May 22 2005
"Vegeta" <lord.vegeta ica.luz.ve> wrote in message news:d6qlak$2ct8$1 digitaldaemon.com...Isn't using I and C or O as prefixes for interfaces and clases hungarian notaion? IIRC, the D Style asks us to Just Say No to hungarian notation. May 22 2005
What about TList ? "T" because of Type ... -- ........... Dejan Lekic http://dejan.lekic.org May 24 2005
What about TList ? "T" because of Type ... May 24 2005
"John Demme" <me teqdruid.com> wrote in message news:1114656516.1363.7.camel localhost.localdomain...I'd prefer C over O... (C for Class), since it looks nicer. Also, I hope that your ConcurrentAA would also implement the interface. It's got my vote! Let me know if you want any help. I'd like to start using interfaces like this immediately. Apr 30 2005
I was considering adding an interface for the associative arrays because the two properties Key[] keys; Value[] values; aren't part of the Collection interface (currently). That would be the only difference between an assoc array interface and a general Collection interface and so it didn't seem worth it. I'll probably end up putting those two properties into Collection since it is natural to want to get access to them. "John Demme" <me teqdruid.com> wrote in message news:1114894587.11519.13.camel localhost.localdomain...I posted without reading the code... stupid me. This looks like it would work, although the naming makes it a little confusing (at least some me.) I guess I never thought of a List as being a special case of a table. John Demme On Sat, 2005-04-30 at 16:47 -0400, John Demme wrote:/** Interface Hierarchy* * Collection * Sliceable * IList */ Apr 30 2005
"John Demme" <me teqdruid.com> wrote in message news:1114894587.11519.13.camel localhost.localdomain...I posted without reading the code... stupid me. This looks like it would work, although the naming makes it a little confusing (at least some me.) I guess I never thought of a List as being a special case of a table. John Demme Apr 30 2005
/** Interface Hierarchy* * Collection * Sliceable * IList */ Apr 30 2005
I posted without reading the code... stupid me. This looks like it would work, although the naming makes it a little confusing (at least some me.) I guess I never thought of a List as being a special case of a table. John Demme On Sat, 2005-04-30 at 16:47 -0400, John Demme wrote:/** Interface Hierarchy* * Collection * Sliceable * IList */ Apr 30 2005
|