If T[new] is the container for T[], then what is the container for T[U]?
Steve Schveighoffer
schveiguy at yahoo.com
Sat Apr 25 09:23:36 PDT 2009
On Sat, 25 Apr 2009 08:07:52 -0500, Andrei Alexandrescu wrote:
> 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.
>
>
> Andrei
You are confusing the difference between T[] and T[U]. T[U] is a strange
beast because it does not need to be new'd, but it acts completely like a
reference type. But T[U] *is* the container type. What you should be
asking is what is the *slice* type for T[U]. My answer would be that a
slice type for a hashtable doesn't make sense. We don't need AAs to be
completely on par with normal arrays, so just leave them alone ;)
-Steve
More information about the Digitalmars-d
mailing list