[vector] Remove generics from Vector.Shape

Paul Sandoz paul.sandoz at oracle.com
Tue Jan 30 00:39:53 UTC 2018



> On Jan 29, 2018, at 4:25 PM, John Rose <john.r.rose at oracle.com> wrote:
> 
> On Jan 29, 2018, at 4:13 PM, Paul Sandoz <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>> wrote:
>> 
>> It's not clear to me why Shape needs to have any type variable which is bound to Vector. 
> 
> It seemed to me (when I first drafted it) that there would be
> places where two vectors of different shapes would need to
> interoperate, and where it would be useful to type-check
> some aspect of the shape, such as its size or lane-type.
> 
> But it all comes down to details.  If shape parameters don't
> add some value in static type checking, take them out.
> 

I don’t think they do as currently expressed (also went down the generics rabbit hole a few times trying alternatives…), i would like to remove ‘em, but will wait a bit in case others want to chime in. 


> Places to look for added value:  Rebracketing operations
> like "change four ints to two doubles", sectioning operations
> like "take upper two ints from four ints", reinterpreting
> operations like "view four floats as four ints".
> 

So far for such operations (currently limited to cast/rebracket/reshape) we need to perform runtime checks. AFAICT such constraints cannot be expressed in the type system (and due to erasure we cannot overload with lots of explicit methods for all the valid combinations).

Paul.



More information about the panama-dev mailing list