Unexpected (to me) behaviour in Lisp sub-typing
Summary
Simon Dobson analyzes unexpected behaviour in Common Lisp array sub-typing (SBCL). The post shows that specialised and default simple-array values may fail type checks when constraining element types (for example unsigned-byte 16) due to upgrades to upgraded-array-element-type. A practical workaround is to explicitly specify the element-type or to use an explicit value to create arrays. The post also discusses why this happens and its relation to array representation optimisations.