Marc Lavergne <mlavergn@richlava.com> writes:
> Simply use an array_dims() on any non-array type,
There is not a lot to be done about that, I'm afraid, since our type
system doesn't have a concept of "any array type". The only way we
have to declare array_dims() is as a function taking any type at all;
so it can't protect itself against inputs that aren't arrays.
We could add some code in array_dims to try to detect the case where
it's handed a non-array pass-by-reference type; but I don't see how
it can guard against a pass-by-value parameter, which will typically
equate to an invalid pointer :-(
A bulletproof solution would require adding the notion of "any array
type" to the type checking system. That might be a good thing to do
someday, but I'm not planning to hold my breath while waiting...
regards, tom lane