How to declare N nested Vectors?

The printing issue also occurs for deeply recursive types, as I discovered recently.

Deeply nested containers kind of have to overflow the stack, because it’s too late to add a depth counter to show, which at least the internal implementations could have used.

But type printing is internal*, and could use a stack with a loop to avoid this. Might be a good first issue, since the fix would be fairly self-contained.

[*] this isn’t 100% true, since it’s possible to overload show(::IO, ::Type{MyType}), however bad an idea that might be. But handling it for the builtin types would flatten the stack enough to avoid a blowup in many more cases.

2 Likes