LispWorks default string construction is affected by the value of
lw:*default-character-element-type*
. If the value is
base-char
then:
(make-string 3)
returns a
simple-base-string
. If the value is
lw:simple-char
then the same form returns a
lw:simple-text-string
.
This variable merely provides the default behaviour. If enough information is supplied, then a string of suitable type is constructed. For instance, the form:
(make-string 3 :initial-element #\Ideographic-Space)
constructs a string of a type that can hold its elements, regardless of the value of
lw:*default-character-element-type*
.
Other string constructors also take their default from this variable. For instnace, the string reader will always construct a string of type determined by this variable, unless it sees a character of a larger type, in which case a suitable string is constructed.
The initial value of
lw:*default-character-element-type*
is
base-char,
to avoid programs that only require 8-bit strings needlessly creating larger string objects. If your application uses Unicode characters beyond the Latin-1 range, then you could ensure that all strings are constructed explicitly with the appropriate type, but a better approach is to change the default. Do this by:
(set-default-character-element-type 'lw:simple-char)