Search
Friday, 14th of June 2019, 15:08:19 UTC
15:13:35
stassats
and now it's a tail-call
17:01:25
pfdietz
(type-of (symbol-name (intern "BAR")) ==> (SIMPLE-ARRAY CHARACTER (3))
17:01:36
pfdietz
(type-of (symbol-name 'baz)) ==> (SIMPLE-BASE-STRING 3)
17:02:03
pfdietz
I wonder if it makes sense to convert the name to a simple-base-string, when possible.
17:03:13
pfdietz
when creating the symbol, that is, not when looking up the string to see if the symbol already exists.
17:03:36
Bike
that makes it look like the reader does do that but intern doesn't
17:05:45
pfdietz
Alternately, the reader should make "BAR" a simple-base-string.
17:06:31
pfdietz
Which is compliant, as simple-base-string is a subtype of simple-string.
17:07:33
pfdietz
I do wonder how much code that change would break, though.
17:12:13
pfdietz
In CCL, (type-of "ABC") ==> (SIMPLE-BASE-STRING 3)
17:13:03
Bike
there's a test in babel that that breaks, because it does something like (setf (char (copy-seq "???") 0) (code-char big-number))
17:19:05
pfdietz
So, that fails under CCL?
17:19:08
stassats
pfdietz: ccl has only one kind of characters
17:19:38
Bike
well, in clasp we did the base string thing and that broke.
17:20:59
pfdietz
"The accumulated characters up to but not including the matching double-quote are made into a simple string and returned."
17:21:40
Bike
yeah, it doesn't specify what class of character to use
17:22:50
pfdietz
That's right. A simple-string is a union of various simple array types; the element type just has to be a subtype of character.
17:23:30
pfdietz
I'd suggest putting in a bug report to babel. That is not compliant code.
17:24:53
Bike
if you go that route you also have the (array nil) thing to contend with.
17:25:33
pfdietz
That would be a valid element type for "".
17:27:12
pfdietz
"A simple string is a specialized one-dimensional simple array whose elements are of type character or a subtype of type character."
17:28:30
pfdietz
(stringp (make-array '(0) :element-type nil)) ==> t
17:30:06
pfdietz
I do not see that test in babel
17:30:20
Bike
uh, let me find it again, i might be misremembering parts
17:30:20
pfdietz
No invocations of copy-seq
17:34:59
Bike
right, it's indirect. substitute. https://github.com/cl-babel/babel/blob/master/tests/tests.lisp#L482-L488
17:37:18
pfdietz
Ok, I will submit a ticket.
17:42:20
pfdietz
https://github.com/cl-babel/babel/issues/34
18:42:41
pfdietz
SBCL already has the mechanism for turning strings into base-strings when reading (when possible.). readtable-base-char-preference in src/code/reader.lisp
Saturday, 15th of June 2019, 3:08:19 UTC