I can't figure this out from the Hyperspec, so I thought I would ask:
is nil a valid type specifier for the element-type of an array?
In SBCL,
CL-USER> (defparameter *a* (make-array 5 :element-type nil))
*A*
CL-USER> (array-element-type *a*)
NIL
CL-USER> *a*
An attempt to access an array of element-type NIL was made. Congratulations!
[Condition of type SB-KERNEL:NIL-ARRAY-ACCESSED-ERROR]See also:
Common Lisp Hyperspec, UPGRADED-ARRAY-ELEMENT-TYPE [function]
Common Lisp Hyperspec, 15.1.2.1 [section]
Common Lisp Hyperspec, 15.1.2.2 [section]
Maybe the answer is in the sections referred there, but I couldn't
find it. Is an array with element-type nil a valid array? What is
its purpose? Is it some strange beast like an array with dimension
that is zero?
Thanks,
Tamas
On Sep 7, 5:58 pm, Tamas Papp <······@gmail.com> wrote:
> I can't figure this out from the Hyperspec, so I thought I would ask:
> is nil a valid type specifier for the element-type of an array?
The type nil is the empty type; there can not be values of that type.
(The value nil is of type null, not type nil.) Nevertheless it is a
valid type specifier for arrays!
In 2003 there was an interesting discussion about these strange
arrays, in particular about what its upgraded-array-element-type
should be:
http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/309e1e34d56e7010/6324a50d14eb6858?lnk=gst&rnum=2#6324a50d14eb6858
- Willem