Next Prev Up Top Contents Index

18.3 String Construction

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 instance, 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 (characters of type extended-char ) then you should consider which of the following two approaches to use:


LispWorks User Guide - 18 Feb 2003

Next Prev Up Top Contents Index