by Krull McSkull >> Thu, 20 May 1999 3:36:15 GMT
Carl,
Interestingly enough, an early version of the JADE object manager (it had a different name in those days) provided such genericity at the 'instance' level. In that incarnation of JOM you defined the membership of a collection when it was used as a property (called instance variables back then). A logical extension was to support instantiating a generic collection in a local variable definition as you are suggesting above. The syntax I favoured at the time was:
vars
customerArray : Array of Customer;
However, the intent is the same. Of course, a slightly more verbose syntax is required to specify a member key dictionary. When we introduced collection subtypes where collection parameters such as membership (and dictionary keys etc.) are defined in the type, we made an incorrect decision (in my opinion) of dropping support for the instance level specification. The main advantage of the generic collection concept is that it avoids a large explosion of collection subtypes that are otherwise required. Things get interesting when you consider what you could do if you could fully define a member key dictionary (membership and keys) as a local variable in a method - anyone remember the thread on 'sorting collections at runtime'?
So, Carl the good news is that we know how to do it. It has been done, its gone but it might well come back .......