Attached is my use case which is parsing of PDF cross reference indices.
There are normally three numeric entries per line. e.g.

xref
0 8
0000000000 65535 f
0000000009 00000 n
0000000074 00000 n
0000000120 00000 n

Which populates nicely into an array of 'n' lines of shape 3.

There's the rare, but possible case of an xref section with zero entries

xref
0 0

(I've encountered real-world PDF's like this).

The attached grammar/actions attempted to handle it as an array of shape
[0;3],
but wont work on current Rakudo.

Just my preferred solution for the above case.
- David


On Sun, Aug 27, 2017 at 12:38 PM, Brandon Allbery via RT <
perl6-bugs-follo...@perl.org> wrote:

> > Well, what do you mean? Of course you can't put anything into it, and any
> > attempt to index it will throw. It may seem useless, however, if you can
> > have
> > an empty array, why can't you have a shaped empty array?
> >
>
> Only if all dimensions are unindexable. Otherwise you have something with
> inaccessible slots (and, potentially thereby, not truly leaked but
> unusable, memory).
>
> And an empty unshaped array, in addition to being usable as such
> (degenerate case of all shaped dimensions being size 0), can be made
> non-empty. Shaped arrays cannot.
>
>

Attachment: Xref.pm
Description: Perl program

Reply via email to