On Tue, 18 Apr 2017 20:34:15 -0700, david.warring wrote: > AFAIK there's currently no way of introspecting the shape of a Class > attribute that's a native shaped array. > > I'd like this feature for the Native::Packing module. For example to > interpret: > > class C { > has byte @.gif-header[6]; > has uint16 $.width; > has uint16 $height; > } > > At the moment, I just can't determine the size of shaped native arrays, > such as @.gif-header above: > > say .type, .container > for C.^attributes; > > (Positional[byte])(array[byte]) > (uint16)(uint16) > (uint16)(uint16)
Seems .container does have method .shape, but it returns a Whatever: class C { has byte @.gif-header[6]; has uint16 $.width; has uint16 $height; } say .container.shape for C.^attributes[0]; # (*) dd C.new.gif-header.shape; # (6,) my byte @z[6]; dd @z.shape; # (6,)