If the value of *default-character-element-type* is
base-char
then:
(make-string 3)
returns a simple-base-string and
(coerce
sequence
'simple-string)
attempts to construct a simple-base-string. This will signal an error if any element of
sequence
is not a
base-char
.
If the value of *default-character-element-type* is
simple-char
then
(make-string 3)
returns a simple-text-string and
(coerce
sequence
'simple-string)
attempts to construct a simple-text-string. This will signal an error if any element of sequence is not a simple-char.
Other string constructors also take their default from *default-character-element-type*. For instance, with-output-to-string and
make-string-output-stream
will construct a stream with element type determined by this variable and generate a string of the same element type.
Also the string reader will always construct a string of type determined by *default-character-element-type*, unless it sees a character of a larger type, in which case a suitable string is constructed. For example:
CL-USER 1 > (set-default-character-element-type 'simple-char)
SIMPLE-CHAR
CL-USER 2 > (type-of "ABC")
SIMPLE-TEXT-STRING
Compatibility note: In LispWorks 6.0 and earlier versions, the string reader would not always obey *default-character-element-type*, due to a bug.
LispWorks User Guide and Reference Manual - 21 Dec 2011