Unless you're talking about an array pointer, or an array of nil-able
values, 'nil' does not enter the picture. There is no singular 'zero value'
for all array types, and types in Go are not runtime creatable, therefore
there's no such thing as a zero value of a set of types. Unless you're
delving into philosophy, then no, an empty array is not 'the zero value of
the array type' (again, if 'empty' even means anything semantically, which
I hold it does not).
Regarding the earlier 'ridicule', I simply meant that zero-length arrays
are not common enough to be worth considering when syntax decisions are
being made; if there's enough argument left over from aspects of the
language that are regularly being used and are sufficiently confusing to
enough people, then so be it.
Rui: it's awkward enough in practice if you try to find reasons to use
zero-length arrays (aside from being zero-sized types, which are useful,
for example, to minimally emulate sets using maps), but it is nonetheless
consistent with the type system theory: there's no real reason not to allow
them.
On Tuesday, January 8, 2013 3:09:03 PM UTC-7, itmi...@gmail.com wrote:On Wednesday, January 9, 2013 12:05:53 AM UTC+2, Kevin Gillette wrote:
That's not accurate at all. The zero value for [1]int is [1]int{0}. The
zero value for [3]int is [3]int{0,0,0}. In other words, the zero value for
an array type is the value wherein each element is the zero value of the
element type.
No, those are zero *values*. We're talking about the zero *value*.
--