Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgraded-array-element-type/class-of for arrays #84

Open
alanruttenberg opened this issue Apr 7, 2018 · 1 comment
Open

upgraded-array-element-type/class-of for arrays #84

alanruttenberg opened this issue Apr 7, 2018 · 1 comment

Comments

@alanruttenberg
Copy link
Collaborator

No code of mine depends on this, but I was reading an article and it prompted me to check types of arrays and how upgraded-array-element-type works.

Bottom line is that it isn't consistent.

CL-USER> (make-array 1 :element-type '(unsigned-byte 16))
#(0)
CL-USER> (jobject-class *)
#<java class org.armedbear.lisp.BasicVector_UnsignedByte16 {6F28B4E2}>
CL-USER> (class-of (make-array 1 :element-type '(unsigned-byte 16)))
#<built-in-class vector {352D86C9}>
CL-USER> (upgraded-array-element-type '(unsigned-byte 16))
(unsigned-byte 16)
CL-USER> (make-array 1 :element-type '(unsigned-byte 17))
#(0)
CL-USER> (jobject-class *)
#<java class org.armedbear.lisp.BasicVector_UnsignedByte32 {1C49E33C}>
CL-USER> (upgraded-array-element-type '(unsigned-byte 17))
t
CL-USER> (class-of (make-array 1 :element-type '(unsigned-byte 17)))
#<built-in-class vector {352D86C9}>

Summary:

  • Implementation of arrays of unsigned byte 16 vs 17 are different
  • class-of reports the same type
  • upgraded-array-element-type of (unsigned-byte 17) reports t, but it is in fact (unsigned-byte 32)
  • trying to set array element of (unsigned-byte 17) to int larger than 2^17 works, but not setting to a symbol, as type t would imply
@easye
Copy link
Collaborator

easye commented Aug 28, 2018

c.f. urn:trac:abcl.org https://abcl.org/trac/ticket/460

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants