As Jutho mentioned, a parametric type without a type parameter is just another abstract type so I don't think there would be any difference in performance.
But if Foo and Bar have the same internal structure, are they really different types at all? You could always do a manual "type" dispatch based on the values or some internal flag. On Sunday, February 1, 2015 at 4:55:27 PM UTC-5, James Crist wrote: > > Thanks, that's kind of what I expected. > > @Tim: > > I found some stuff in there (and in the very helpful Types section), but > never saw explicitly whether a collection of unparametrized parametric type > offered any additional benefit to the compiler than one of just abstract > type. (i.e. Rational[] vs Real[]). Since the container type isn't concrete, > I figured it probably wouldn't offer any benefit, but thought I'd ask. > > - Jim > > > On Sun, Feb 1, 2015 at 5:07 AM, Tim Holy <[email protected] <javascript:>> > wrote: > >> James, in case you haven't seen it, this is treated _extensively_ in the >> FAQ. >> Make a nice cup of tea and pull up a comfy chair before you start reading >> :-). >> >> --Tim >> >> On Sunday, February 01, 2015 01:16:19 AM Jutho wrote: >> > As long as not all parameters of a parametric concrete type are fully >> > specified, the type is treated as abstract. So in both cases your >> > collection would be of abstract elements and they would not be stored >> > packed in memory. I don't think what you are requesting is possible, >> but I >> > might be mistaken. If the elements of the collection are of a concrete >> > type, then applying a function to them should always be the same >> function. >> > If this were not the case, then type inference could not work. >> >> >
