If T[new] is the container for T[], then what is the container for T[U]?

Michel Fortin michel.fortin at michelf.com
Sat Apr 25 06:54:40 PDT 2009


On 2009-04-25 09:07:52 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> It looks we can't make it with only T[]. We need a genuine container 
> type, and T[new] was suggested. It would probably have value semantics.
> 
> T[U] seems to have the same problem. If T[U] is the range, then how do 
> you call the container?
> 
> If we follow through with a no-garbage-collected option for the core 
> types, then we also need to distinguish between a slice and its 
> container. The fact that we (almost) got away with T[] being at the 
> same time the container and the slice was that the garbage collector 
> would collect all unused slices.

I always disliked T[new]. Here's a better candidate:

      | range  | container
----- | ------ | ---------
array | T[]    | T.[]
assoc | T[U]   | T.[U]

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list